Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router Revamp #49

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const DefaultLayout: React.FC<LayoutProps> = ({ children=null }) => {
) : (
<Navbar />
)}
{children}
<div style={{marginTop: "105px"}}>
{children}
</div>
</>
);
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/shared/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ function Navbar() {
<div>
<div className={styles.overallHeader}>
<div>
<a href="/public">
<Link to="/">
<img
src={fintechLogo}
alt="fintech Logo"
className={styles.fintechLogo}
/>
</a>
</Link>
</div>
<div>
<Link to="/announcements" className={styles.Link}>
Expand Down
2 changes: 2 additions & 0 deletions src/components/shared/NavBarMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ function NavBarMobile() {
<header>
<div className={styles.overallHeader}>
<div>
<Link to="/">
<img
src={fintechLogo}
alt="fintech Logo"
className={styles.fintechLogo}
/>
</Link>
</div>
<div>
{showSideBar ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";

const Announcements: React.FC = () => {
console.log("i am here ")
return (
<div>
<h1>Announcements</h1>
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions src/components/shared/Home.tsx → src/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from "react";
import Navbar from "./NavBar.tsx";
import NavbarMobile from "./NavBarMobile.tsx";

const Home: React.FC = () => {
return (
<div>
<Navbar />
<h1>Home</h1>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "react";
const Members: React.FC = () => {
return (
<div>
<h1>members</h1>
<h1>Members</h1>
</div>
);
};
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion src/routes/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import DefaultLayout from "components/layout.tsx";
import { Outlet } from "react-router-dom";


const App = () => {
return (
<DefaultLayout/>
<DefaultLayout children={<Outlet />}/>
);
};

Expand Down
38 changes: 36 additions & 2 deletions src/routes/router.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
import { createBrowserRouter } from "react-router-dom";
import routesConfig from "routes/routesConfig.ts";
import TestPage from "./shared/TestPage.tsx";
import App from "./App.tsx";
import Home from "@/pages/Home.tsx";
import Announcements from "@/pages/Announcements.tsx";
import Members from "@/pages/Members.tsx";
import Tasks from "@/pages/Tasks.tsx";
import Events from "@/pages/Events.tsx";

const router = createBrowserRouter(routesConfig);
const router = createBrowserRouter([
{
path: "/",
element: <App />,
children: [{
path: '/',
element: <Home />
},
{
path: 'announcements',
element: <Announcements />
},
{
path: 'members',
element: <Members />
},
{
path: 'events',
element: <Events />
}, {
path: 'tasks',
element: <Tasks />
}]
},
{
path: "/test",
Component: TestPage,
}
]);

export default router;