rewraping app with framer motion
This commit is contained in:
parent
4384caad0a
commit
2906315a4d
48
src/App.js
48
src/App.js
|
|
@ -2,46 +2,28 @@ import "./assets/css/App.scss";
|
|||
import Home from "./pages/Home.jsx";
|
||||
import Single from "./pages/Single.jsx";
|
||||
import Profile from "./pages/Profile.jsx";
|
||||
import Country from "./pages/Country.jsx";
|
||||
import Results from "./pages/Results.jsx";
|
||||
import Test from "./pages/Test.jsx";
|
||||
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import Game from "./pages/Game.jsx";
|
||||
|
||||
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
||||
|
||||
const router = createBrowserRouter([
|
||||
{
|
||||
path: "/",
|
||||
element: <Home />,
|
||||
},
|
||||
{
|
||||
path: "/select-profile",
|
||||
element: <Profile />,
|
||||
},
|
||||
{
|
||||
path: "/play",
|
||||
element: <Game />,
|
||||
},
|
||||
{
|
||||
path: "/results",
|
||||
element: <Results />,
|
||||
},
|
||||
{
|
||||
path: "/article/:id",
|
||||
element: <Single />,
|
||||
},
|
||||
{
|
||||
path: "/test",
|
||||
element: <Test />,
|
||||
},
|
||||
]);
|
||||
import { useLocation, Routes, Route } from "react-router-dom";
|
||||
import { AnimatePresence } from "framer-motion";
|
||||
|
||||
function App() {
|
||||
const location = useLocation();
|
||||
return (
|
||||
<>
|
||||
{/* <button onClick={changeLanguage}>Change language</button> */}
|
||||
<RouterProvider router={router} />;
|
||||
</>
|
||||
<AnimatePresence mode='wait'>
|
||||
<Routes location={location} key={location.pathname}>
|
||||
<Route path='/' element={<Home />} />
|
||||
<Route path='/select-profile' element={<Profile />} />
|
||||
<Route path='/select-country' element={<Country />} />
|
||||
<Route path='/play' element={<Game />} />
|
||||
<Route path='/results' element={<Results />} />
|
||||
<Route path='/test' element={<Test />} />
|
||||
</Routes>
|
||||
</AnimatePresence>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,19 @@ import ReactDOM from "react-dom/client";
|
|||
import "./index.css";
|
||||
import App from "./App";
|
||||
import { UserContextProvider } from "./context/UserContext.js";
|
||||
import { BrowserRouter, Route, Routes, useLocation } from "react-router-dom";
|
||||
import { AnimatePresence } from "framer-motion";
|
||||
import Home from "./pages/Home.jsx";
|
||||
import Profile from "./pages/Profile.jsx";
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById("root"));
|
||||
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<UserContextProvider>
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
</UserContextProvider>
|
||||
</React.StrictMode>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user