11import "./App.css" ;
2- import { Routes , Route } from "react-router-dom" ;
2+ import { Routes , Route , Outlet } from "react-router-dom" ;
33import { useRef } from "react" ;
44import Home from "./pages/Home" ;
55import Projects from "./pages/Projects" ;
@@ -9,26 +9,44 @@ import NotFound from "./pages/404";
99import SlideshowBg from "./pages/SlideshowBg" ;
1010import Header from "./pages/Header" ;
1111import Project from "./pages/Project" ;
12+ import { NavigationProvider } from "./utils/NavigationProvider" ;
1213
1314function App ( ) {
1415 const containerRef = useRef < HTMLSpanElement | null > ( null ) ;
16+ const containerRef2 = useRef < HTMLDivElement | null > ( null ) ;
1517
1618 return (
17- < Header containerRef = { containerRef } >
19+ < Header containerRef = { containerRef } containerRef2 = { containerRef2 } >
1820 < Routes >
1921 < Route path = "/" element = { < SlideshowBg containerRef = { containerRef } /> } >
2022 < Route index element = { < Home /> } />
2123 < Route path = "about" element = { < About /> } />
2224 < Route path = "contact" element = { < Contact /> } />
2325 </ Route >
24- < Route path = "/projects" element = { < Projects /> } />
25- < Route path = "/projects/:projectId" element = { < Project /> } />
26- < Route path = "/mini-projects" element = { < Projects /> } />
27- < Route path = "/mini-projects/:projectId" element = { < Project /> } />
26+ < Route path = "/" element = { < Container containerRef = { containerRef2 } /> } >
27+ < Route path = "/projects" element = { < Projects /> } />
28+ < Route path = "/projects/:projectId" element = { < Project /> } />
29+ < Route path = "/mini-projects" element = { < Projects key = { "mini" } /> } />
30+ < Route path = "/mini-projects/:projectId" element = { < Project /> } />
31+ </ Route >
2832 < Route path = "*" element = { < NotFound /> } />
2933 </ Routes >
3034 </ Header >
3135 ) ;
3236}
3337
3438export default App ;
39+
40+ function Container ( {
41+ containerRef,
42+ } : {
43+ containerRef : React . RefObject < HTMLSpanElement | null > ;
44+ } ) {
45+ return (
46+ < span className = "container" ref = { containerRef } >
47+ < NavigationProvider containerRef = { containerRef } >
48+ < Outlet />
49+ </ NavigationProvider >
50+ </ span >
51+ ) ;
52+ }
0 commit comments