summaryrefslogtreecommitdiff
path: root/src/pages/_app.jsx
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2023-03-01 09:18:52 +0000
committerIT Fixcomart <it@fixcomart.co.id>2023-03-01 09:18:52 +0000
commita7abbf4ddc70068620e9f44b74dc162ce2e16ee2 (patch)
tree74f66253717515d364ce74bd8275015c1f829cbc /src/pages/_app.jsx
parent90e1edab9b6a8ccc09a49fed3addbec2cbc4e4c3 (diff)
parenta1b9b647a6c4bda1f5db63879639d44543f9557e (diff)
Merged in refactor (pull request #1)
Refactor
Diffstat (limited to 'src/pages/_app.jsx')
-rw-r--r--src/pages/_app.jsx42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx
new file mode 100644
index 00000000..e32efc19
--- /dev/null
+++ b/src/pages/_app.jsx
@@ -0,0 +1,42 @@
+import '../styles/globals.css'
+import NextProgress from 'next-progress'
+import { useRouter } from 'next/router'
+import { AnimatePresence } from 'framer-motion'
+import { Toaster } from 'react-hot-toast'
+import { QueryClient, QueryClientProvider } from 'react-query'
+
+const queryClient = new QueryClient()
+
+function MyApp({ Component, pageProps }) {
+ const router = useRouter()
+
+ return (
+ <>
+ <Toaster
+ position='top-center'
+ toastOptions={{
+ duration: 3000,
+ className: 'border border-gray_r-8'
+ }}
+ />
+ <NextProgress
+ color='#F01C21'
+ options={{ showSpinner: false }}
+ />
+ <QueryClientProvider client={queryClient}>
+ <AnimatePresence
+ mode='wait'
+ initial={false}
+ onExitComplete={() => window.scrollTo(0, 0)}
+ >
+ <Component
+ {...pageProps}
+ key={router.asPath}
+ />
+ </AnimatePresence>
+ </QueryClientProvider>
+ </>
+ )
+}
+
+export default MyApp