Skip to content

Commit

Permalink
refactor: RootContext, RootModal 로 병합
Browse files Browse the repository at this point in the history
  • Loading branch information
toothlessdev committed Jun 9, 2024
1 parent d2caae4 commit cfdd4ff
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import "@/styles/globals.css";
import type { AppProps } from "next/app";
import { QueryClient, QueryClientProvider, useQueryClient } from "@tanstack/react-query";

import "@fortawesome/fontawesome-svg-core/styles.css";
import "react-toastify/dist/ReactToastify.css";
import { Toast } from "@/components/feedback/Toast/Toast";
import { NavBar } from "@/components/navigation/NavBar";
import { ProfileContextProvider } from "@/context/ProfileContext";
import { useRouter } from "next/router";
import "react-toastify/dist/ReactToastify.css";

import { AnimatePresence } from "framer-motion";
import { motion } from "framer-motion";

import { RootModal } from "@/components/feedback/Modal";
import { Toast } from "@/components/feedback/Toast/Toast";
import { NavBar } from "@/components/navigation/NavBar";

import "@/styles/globals.css";

import { RootContextProvider } from "@/context/RootContext";
import "@fortawesome/fontawesome-svg-core/styles.css";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";

export const queryClient = new QueryClient({
defaultOptions: {
queries: {
Expand All @@ -30,13 +33,21 @@ export default function App({ Component, pageProps }: AppProps) {
return (
<AnimatePresence mode="wait">
<QueryClientProvider client={queryClient}>
<ProfileContextProvider>
<RootContextProvider>
<RootModal />
<Toast />

<NavBar />
<motion.main key={router.route} initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: 0.5 }}>
<motion.main
key={router.route}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.5 }}
>
<Component {...pageProps} />
</motion.main>
</ProfileContextProvider>
</RootContextProvider>
</QueryClientProvider>
</AnimatePresence>
);
Expand Down

0 comments on commit cfdd4ff

Please sign in to comment.