diff options
| author | Factiven <[email protected]> | 2023-04-11 23:23:29 +0700 |
|---|---|---|
| committer | Factiven <[email protected]> | 2023-04-11 23:23:29 +0700 |
| commit | 1fcdd9f7d859b925bf92265f441655d5522e351c (patch) | |
| tree | 86391522f6fcc70d105f7e796a9f91d132ee4a29 /pages/_app.js | |
| parent | Initial commit (diff) | |
| download | moopa-1fcdd9f7d859b925bf92265f441655d5522e351c.tar.xz moopa-1fcdd9f7d859b925bf92265f441655d5522e351c.zip | |
initial commit
Diffstat (limited to 'pages/_app.js')
| -rw-r--r-- | pages/_app.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/pages/_app.js b/pages/_app.js new file mode 100644 index 0000000..869f66e --- /dev/null +++ b/pages/_app.js @@ -0,0 +1,48 @@ +import { ThemeProvider } from "next-themes"; +import "../styles/globals.css"; +import { useRouter } from "next/router"; +import { AnimatePresence, motion as m } from "framer-motion"; +import NextNProgress from "nextjs-progressbar"; +import { SessionProvider } from "next-auth/react"; + +export default function App({ + Component, + pageProps: { session, ...pageProps }, +}) { + const router = useRouter(); + + return ( + <SessionProvider session={session}> + <ThemeProvider attribute="class"> + <AnimatePresence mode="wait"> + <m.div + key={`route-${router.route}`} + transition={{ duration: 0.5 }} + initial="initialState" + animate="animateState" + exit="exitState" + variants={{ + initialState: { + opacity: 0, + }, + animateState: { + opacity: 1, + }, + exitState: {}, + }} + className="z-50 w-screen" + > + <NextNProgress + color="#FF7E2C" + startPosition={0.3} + stopDelayMs={200} + height={3} + showOnShallow={true} + /> + <Component {...pageProps} /> + </m.div> + </AnimatePresence> + </ThemeProvider> + </SessionProvider> + ); +} |