File tree 8 files changed +158
-24
lines changed
8 files changed +158
-24
lines changed Original file line number Diff line number Diff line change 14
14
"@tailwindcss/vite" : " ^4.1.4" ,
15
15
"react" : " ^19.0.0" ,
16
16
"react-dom" : " ^19.0.0" ,
17
+ "react-router-dom" : " ^7.5.0" ,
17
18
"react-icons" : " ^5.5.0" ,
18
19
"tailwindcss" : " ^4.1.4"
19
20
},
Original file line number Diff line number Diff line change
1
+ import { useEffect , useState } from "react" ;
2
+ import { Outlet } from "react-router-dom" ;
1
3
import SideNav from "./components/SideNav" ;
2
- import PopularActivities from "./components/PopularActivities" ;
3
- import WeeklySchedule from "./components/WeeklySchedule" ;
4
4
import RightContent from "./components/RightContent" ;
5
- import PersonalBests from "./components/PersonalBests" ;
5
+ // function App() {
6
+ // return (
7
+ // <>
8
+ // {/* This is where the Navbar and other components will be rendered */}
9
+ //
10
+ // </>
6
11
7
12
export default function App ( ) {
8
13
return (
@@ -11,17 +16,8 @@ export default function App() {
11
16
< div className = "flex-shrink-0" >
12
17
< SideNav />
13
18
</ div >
14
- < div className = "flex flex-col flex-1 w-full p-4 md:p-8 overflow-y-auto min-h-0" >
15
- < PopularActivities />
16
- < div className = "flex flex-col md:flex-row gap-4 md:gap-8 mt-8" >
17
- < div className = "w-full md:w-1/2" >
18
- < WeeklySchedule />
19
- </ div >
20
- < div className = "w-full md:w-1/2" >
21
- < PersonalBests />
22
- </ div >
23
- </ div >
24
- </ div >
19
+ < Outlet /> { " " }
20
+ { /* This is where the Content (child routes) will be rendered */ }
25
21
< div className = "w-full md:w-64 p-4 flex-shrink-0 overflow-y-auto min-h-0" >
26
22
< RightContent />
27
23
</ div >
Original file line number Diff line number Diff line change @@ -32,54 +32,61 @@ const SideNav: React.FC = () => {
32
32
TTP Code App
33
33
</ div >
34
34
< a
35
- href = "#home "
35
+ href = "/ "
36
36
className = "text-base md:text-lg p-2 md:p-0"
37
37
onClick = { toggleMenu }
38
38
>
39
39
Home
40
40
</ a >
41
41
< a
42
- href = "#profile"
42
+ href = "#profile" //update this to the correct route
43
43
className = "text-base md:text-lg p-2 md:p-0"
44
44
onClick = { toggleMenu }
45
45
>
46
46
Profile
47
47
</ a >
48
48
< a
49
- href = "#schedule"
49
+ href = "#schedule" //update this to the correct route
50
50
className = "text-base md:text-lg p-2 md:p-0"
51
51
onClick = { toggleMenu }
52
52
>
53
53
Schedule
54
54
</ a >
55
55
< a
56
- href = "#activities"
56
+ href = "#activities" //update this to the correct route
57
57
className = "text-base md:text-lg p-2 md:p-0"
58
58
onClick = { toggleMenu }
59
59
>
60
60
Activities
61
61
</ a >
62
62
< a
63
- href = "#settings"
63
+ href = "#settings" //update this to the correct route
64
64
className = "text-base md:text-lg p-2 md:p-0"
65
65
onClick = { toggleMenu }
66
66
>
67
67
Settings
68
68
</ a >
69
69
< a
70
- href = "#quiz"
70
+ href = "#quiz" //update this to the correct route
71
71
className = "text-base md:text-lg p-2 md:p-0"
72
72
onClick = { toggleMenu }
73
73
>
74
74
Quiz
75
75
</ a >
76
76
< a
77
- href = "#leetcode"
77
+ href = "#leetcode" //update this to the correct route
78
78
className = "text-base md:text-lg p-2 md:p-0"
79
79
onClick = { toggleMenu }
80
80
>
81
81
Leetcode
82
82
</ a >
83
+ < a
84
+ href = "/about" //update this to the correct route
85
+ className = "text-base md:text-lg p-2 md:p-0"
86
+ onClick = { toggleMenu }
87
+ >
88
+ About Us
89
+ </ a >
83
90
</ div >
84
91
85
92
{ isOpen && (
Original file line number Diff line number Diff line change 1
1
import { StrictMode } from "react" ;
2
2
import { createRoot } from "react-dom/client" ;
3
3
import "./index.css" ;
4
- import App from "./App.tsx" ;
4
+ import { RouterProvider } from "react-router-dom" ;
5
+ import { router } from "./router.js" ;
5
6
6
7
createRoot ( document . getElementById ( "root" ) ! ) . render (
7
8
< StrictMode >
8
- < App />
9
- </ StrictMode > ,
9
+ < RouterProvider router = { router } />
10
+ </ StrictMode >
10
11
) ;
Original file line number Diff line number Diff line change
1
+ import React from "react" ;
2
+
3
+ const AboutUs = ( ) => {
4
+ return (
5
+ < div >
6
+ < h1 > About Us</ h1 >
7
+ < p >
8
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
9
+ tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
10
+ veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
11
+ commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
12
+ velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
13
+ occaecat cupidatat non proident, sunt in culpa qui officia deserunt
14
+ mollit anim id est laborum.
15
+ </ p >
16
+ </ div >
17
+ ) ;
18
+ } ;
19
+
20
+ export default AboutUs ;
Original file line number Diff line number Diff line change
1
+ import React from "react" ;
2
+ import PopularActivities from "../components/PopularActivities" ;
3
+ import WeeklySchedule from "../components/WeeklySchedule" ;
4
+
5
+ import PersonalBests from "../components/PersonalBests" ;
6
+
7
+ const Home = ( ) => {
8
+ return (
9
+ < div >
10
+ < div className = "flex flex-col flex-1 w-full p-4 md:p-8 overflow-y-auto min-h-0" >
11
+ < PopularActivities />
12
+ < div className = "flex flex-col md:flex-row gap-4 md:gap-8 mt-8" >
13
+ < div className = "w-full md:w-1/2" >
14
+ < WeeklySchedule />
15
+ </ div >
16
+ < div className = "w-full md:w-1/2" >
17
+ < PersonalBests />
18
+ </ div >
19
+ </ div >
20
+ </ div >
21
+ </ div >
22
+ ) ;
23
+ } ;
24
+
25
+ export default Home ;
Original file line number Diff line number Diff line change
1
+ import { createBrowserRouter } from "react-router-dom" ;
2
+ import App from "./App.tsx" ;
3
+
4
+ import AboutUs from "./pages/AboutUs.tsx" ;
5
+ import Home from "./pages/Home.tsx" ;
6
+ export const router = createBrowserRouter ( [
7
+ {
8
+ path : "/" ,
9
+ element : < App /> ,
10
+
11
+ children : [
12
+ { path : "about" , element : < AboutUs /> } ,
13
+ { path : "/" , element : < Home /> } ,
14
+ ] ,
15
+ } ,
16
+ ] ) ;
You can’t perform that action at this time.
0 commit comments