|
import '@/styles/animate.css' |
|
import '@/styles/globals.css' |
|
import '@/styles/nprogress.css' |
|
import '@/styles/utility-patterns.css' |
|
|
|
|
|
import 'react-notion-x/src/styles.css' |
|
import '@/styles/notion.css' |
|
import 'aos/dist/aos.css' |
|
|
|
import { GlobalContextProvider } from '@/lib/global' |
|
import { getGlobalLayoutByTheme } from '@/themes/theme' |
|
import { useRouter } from 'next/router' |
|
import { useCallback, useMemo } from 'react' |
|
import { getQueryParam } from '../lib/utils' |
|
import useAdjustStyle from '@/hooks/useAdjustStyle' |
|
|
|
|
|
import ExternalPlugins from '@/components/ExternalPlugins' |
|
import GlobalHead from '@/components/GlobalHead' |
|
import BLOG from '@/blog.config' |
|
|
|
|
|
|
|
|
|
|
|
|
|
const MyApp = ({ Component, pageProps }) => { |
|
|
|
useAdjustStyle(); |
|
|
|
const route = useRouter() |
|
const queryParam = useMemo(() => { |
|
return getQueryParam(route.asPath, 'theme') || pageProps?.NOTION_CONFIG?.THEME || BLOG.THEME |
|
}, [route]) |
|
|
|
|
|
const GLayout = useCallback( |
|
props => { |
|
|
|
const Layout = getGlobalLayoutByTheme(queryParam) |
|
return <Layout {...props} /> |
|
}, |
|
[queryParam] |
|
) |
|
|
|
return ( |
|
<GlobalContextProvider {...pageProps}> |
|
<GLayout {...pageProps}> |
|
<GlobalHead {...pageProps}/> |
|
<Component {...pageProps} /> |
|
</GLayout> |
|
<ExternalPlugins {...pageProps} /> |
|
</GlobalContextProvider> |
|
) |
|
} |
|
|
|
export default MyApp |
|
|