Skip to content

Commit

Permalink
Feature ticket 138 routing configuration (#142)
Browse files Browse the repository at this point in the history
Added Navbar to router.

Added nested routing.

Added pages:
  - Signup page
  - Display page

---------

Co-authored-by: ravikth <[email protected]>
Co-authored-by: Nakul Bhandare <[email protected]>
  • Loading branch information
3 people authored Feb 13, 2025
1 parent 07922ba commit fe68087
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 11 deletions.
10 changes: 9 additions & 1 deletion frontend/web-app/src/Components/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import React from 'react'
import { Link, Outlet } from 'react-router-dom';

function NavBar() {
return (
<div>NavBar</div>
<div>
<div>
<Link to="/">Home</Link>
<Link to="/about">About</Link>
<Link to="/faq">FAQ</Link>
</div>
<Outlet />
</div>
)
};

Expand Down
37 changes: 27 additions & 10 deletions frontend/web-app/src/Components/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import PlantDetailPage from "../Pages/PlantDetailPage";
import AboutPage from "../Pages/AboutPage";
import FaqPage from "../Pages/FaqPage";
import ErrorPage from "../Pages/ErrorPage";
import NavBar from "./NavBar";
import SignUpPage from "../Pages/SignUpPage";
import DisplayPage from "../Pages/DisplayPage";

const router = createBrowserRouter([
{
Expand All @@ -15,21 +18,35 @@ const router = createBrowserRouter([
element: <LoginPage/>,
},
{
path: '/',
element: <HomePage/>,
path: '/signup',
element: <SignUpPage />,
},
{
path: '/plant_detail',
element: <PlantDetailPage/>,
path: '/display',
element: <DisplayPage />
},
{
path: '/about',
element: <AboutPage />,
path: '/',
element: <NavBar />,
children: [
{
path: '/',
element: <HomePage/>,
},
{
path: '/plant_detail',
element: <PlantDetailPage/>,
},
{
path: '/about',
element: <AboutPage />,
},
{
path: '/faq',
element: <FaqPage />,
}
]
},
{
path: '/faq',
element: <FaqPage />,
}
]);

function Provider() {
Expand Down
9 changes: 9 additions & 0 deletions frontend/web-app/src/Pages/DisplayPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

function DisplayPage() {
return (
<div>DisplayPage</div>
)
}

export default DisplayPage
9 changes: 9 additions & 0 deletions frontend/web-app/src/Pages/SignUpPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

function SignUpPage() {
return (
<div>SignUpPage</div>
)
}

export default SignUpPage

0 comments on commit fe68087

Please sign in to comment.