1- import { BrowserRouter , Route , Routes } from "react-router-dom" ;
1+ import { Route , Routes , useLocation } from "react-router-dom" ;
22import OnboardingConcernPage from "./services/onboarding/additional/concern" ;
33import OnboardingEmotionPage from "./services/onboarding/additional/emotion" ;
44import OnboardingCompletePage from "./services/onboarding/additional/complete" ;
@@ -7,12 +7,17 @@ import NotFoundPage from "./services/error/404";
77import OnboardingBasicPage from "./services/onboarding/basic" ;
88import LoginPage from "./services/auth/login" ;
99import Layout from "./layout.tsx" ;
10+ import { AnimatePresence } from "framer-motion" ;
11+ import { useNavigationDirection } from "./hooks/animation/useNavigationDirection.ts" ;
1012
1113function App ( ) {
14+ const location = useLocation ( ) ;
15+ const direction = useNavigationDirection ( ) ;
16+
1217 return (
13- < BrowserRouter >
14- < Routes >
15- < Route element = { < Layout /> } >
18+ < AnimatePresence mode = "wait" >
19+ < Routes location = { location } key = { location . pathname } >
20+ < Route element = { < Layout direction = { direction } /> } >
1621 < Route index element = { < HomePage /> } />
1722 < Route path = "onboarding" >
1823 < Route index path = "*" element = { < NotFoundPage /> } />
@@ -28,7 +33,7 @@ function App() {
2833 </ Route >
2934 < Route path = "/login" element = { < LoginPage /> } />
3035 </ Routes >
31- </ BrowserRouter >
36+ </ AnimatePresence >
3237 ) ;
3338}
3439
0 commit comments