Skip to content

Commit

Permalink
Added some routes in App.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
DC104 committed Sep 18, 2024
1 parent 7951eb8 commit 775609c
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
import { BrowserRouter as Router, Routes, Route, Outlet } from 'react-router-dom';

import Navbar from './components/Navbar'; // Make sure to import your Navbar component
import Home from './components/Home';
import Body from './components/Body';
import Login from './Pages/Login';
import Signup from './Pages/SIgnup'; // Fix casing for Signup
import Signup from './Pages/Signup'; // Fixed casing for Signup
import Dashboard from './Pages/Dashboard';
import Profile from './Pages/profile';
import Profile from './Pages/Profile'; // Fixed casing for Profile

const Layout = () => {
// Main layout component including Navbar
const MainLayout = () => {
return (
<>
<Navbar /> {/* Navbar visible across all routes */}
<Outlet /> {/* Renders the specific route component */}
</>
);
}

const HomeLayout = () => {
return (
<>
<Home />
<Outlet /> {/* This renders the specific route component */}
<Outlet /> {/* Renders the specific route component */}
</>
);
}

function App() {
const App = () => {
return (
<Router>
<Routes>

<Route path="/" element={<Layout />}>

<Route path="body" element={<Body />} />
{/* Home route layout */}
<Route path="/" element={<HomeLayout />}>
<Route index element={<Body />} /> {/* Default route */}
</Route>

{/* Main layout without Home */}
<Route element={<MainLayout />}>
<Route path="login" element={<Login />} />
<Route path="signup" element={<Signup />} />
<Route path="signup" element={<Signup />} />
<Route path="dashboard" element={<Dashboard />} />
<Route path="profile" element={<Profile />} />
</Route>
Expand Down

0 comments on commit 775609c

Please sign in to comment.