Skip to content

Commit c3d72a2

Browse files
committed
Creating about me page
1 parent 35243b3 commit c3d72a2

File tree

13 files changed

+188
-8
lines changed

13 files changed

+188
-8
lines changed

.DS_Store

2 KB
Binary file not shown.

assets/.DS_Store

6 KB
Binary file not shown.

assets/images/biwa.png

18 MB
Loading

assets/images/biwa_boats.png

5.97 MB
Loading

assets/images/vermont.png

25.7 MB
Loading

assets/images/wini.png

18.6 MB
Loading

src/.DS_Store

0 Bytes
Binary file not shown.

src/App.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@ import Home from './pages/Home';
33
import Darts from './pages/Darts';
44
import Cricket from './pages/Cricket';
55
import X01 from './pages/X01';
6+
import AboutMe from './pages/AboutMe';
7+
import ScrollToTop from "./components/ScrollToTop";
68

79
export default function App() {
810
return (
9-
<Routes>
10-
<Route path="/home" element={<Home />} />
11-
<Route path="/darts" element={<Darts />} />
12-
<Route path="/darts/cricket" element={<Cricket />} />
13-
<Route path="/darts/x01" element={<X01 />} />
14-
<Route path="*" element={<Home />} />
15-
</Routes>
11+
<>
12+
<ScrollToTop />
13+
<Routes>
14+
<Route path="/home" element={<Home />} />
15+
<Route path="/darts" element={<Darts />} />
16+
<Route path="/darts/cricket" element={<Cricket />} />
17+
<Route path="/darts/x01" element={<X01 />} />
18+
<Route path="/about-me" element={<AboutMe />} />
19+
<Route path="*" element={<Home />} />
20+
</Routes>
21+
</>
1622
);
1723
}

src/components/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type NavItem = { label: string; href: string };
66

77
const HOME_HREF = "/";
88
const MENU_LABEL = "Explore";
9-
const MENU_ITEMS: NavItem[] = [{ label: "Darts", href: "/darts" }];
9+
const MENU_ITEMS: NavItem[] = [{ label: "Darts", href: "/darts" },{ label: "About Me", href: "/about-me" }];
1010

1111
export default function Header() {
1212
const [open, setOpen] = useState(false);

src/components/ScrollToTop.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// used to bring the user to the top of the page whenever they are navigating to a new one
2+
3+
import { useEffect } from "react";
4+
import { useLocation } from "react-router-dom";
5+
6+
export default function ScrollToTop() {
7+
useEffect(() => {
8+
window.scrollTo({ top: 0, left: 0, behavior: "instant" as ScrollBehavior });
9+
}, [useLocation().pathname]);
10+
11+
return null;
12+
}

0 commit comments

Comments
 (0)