⚒️ Add nprogress & page transitions.

This commit is contained in:
pheralb 2022-06-21 15:17:01 +01:00
parent 6ee9acba5a
commit 0c11cc399a

View File

@ -8,19 +8,48 @@ import "@/styles/globals.css";
// Layout ->
import Layout from "@/layout";
// Nextjs Progressbar ->
import NextNProgress from "nextjs-progressbar";
// Framer ->
import { motion } from "framer-motion";
// SWR Config & services ->
import { SWRConfig } from "swr";
import { fetcher } from "@/services/fetcher";
function MyApp({ Component, pageProps }: AppProps) {
function MyApp({ Component, pageProps, router }: AppProps) {
return (
<ChakraProvider theme={theme}>
<SWRConfig value={{ fetcher }}>
<Layout>
<Component {...pageProps} />
</Layout>
</SWRConfig>
</ChakraProvider>
<>
<NextNProgress
color="#4343E5"
startPosition={0.3}
stopDelayMs={200}
height={3}
showOnShallow={true}
/>
<ChakraProvider theme={theme}>
<SWRConfig value={{ fetcher }}>
<Layout>
<motion.div
key={router.route}
initial="initial"
animate="animate"
variants={{
initial: {
opacity: 0,
},
animate: {
opacity: 1,
},
}}
>
<Component {...pageProps} />
</motion.div>
</Layout>
</SWRConfig>
</ChakraProvider>
</>
);
}