-
Notifications
You must be signed in to change notification settings - Fork 234
/
root.tsx
52 lines (49 loc) · 1.22 KB
/
root.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import type { MetaFunction } from "@remix-run/node";
import {
Links,
LiveReload,
Meta,
NavLink,
Scripts,
ScrollRestoration,
} from "@remix-run/react";
import { AnimatePresence, motion } from "framer-motion";
import { useLocation, useOutlet } from "react-router-dom";
export const meta: MetaFunction = () => ({
charset: "utf-8",
title: "New Remix App",
viewport: "width=device-width,initial-scale=1",
});
export default function App() {
const outlet = useOutlet();
return (
<html lang="en">
<head>
<Meta />
<Links />
</head>
<body>
<header>
<nav>
<NavLink to="/">Home</NavLink>
<NavLink to="/about">About</NavLink>
<NavLink to="/blogs">Blogs</NavLink>
</nav>
</header>
<AnimatePresence exitBeforeEnter initial={false}>
<motion.main
key={useLocation().pathname}
initial={{ x: "10%", opacity: 0 }}
animate={{ x: "0", opacity: 1 }}
exit={{ x: "-40%", opacity: 0 }}
>
{outlet}
</motion.main>
</AnimatePresence>
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
}