// import '@/styles/animate.css' // @see https://animate.style/ import '@/styles/globals.css' import '@/styles/utility-patterns.css' // core styles shared by all of react-notion-x (required) import '@/styles/notion.css' // 重写部分notion样式 import 'react-notion-x/src/styles.css' // 原版的react-notion-x import useAdjustStyle from '@/hooks/useAdjustStyle' 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 BLOG from '@/blog.config' import ExternalPlugins from '@/components/ExternalPlugins' import GlobalHead from '@/components/GlobalHead' import { ClerkProvider } from '@clerk/nextjs' /** * App挂载DOM 入口文件 * @param {*} param0 * @returns */ const MyApp = ({ Component, pageProps }) => { // 一些可能出现 bug 的样式,可以统一放入该钩子进行调整 useAdjustStyle() const route = useRouter() const queryParam = useMemo(() => { return ( getQueryParam(route.asPath, 'theme') || pageProps?.NOTION_CONFIG?.THEME || BLOG.THEME ) }, [route]) // 整体布局 const GLayout = useCallback( props => { // 根据页面路径加载不同Layout文件 const Layout = getGlobalLayoutByTheme(queryParam) return }, [queryParam] ) const enableClerk = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY const content = ( ) return <>{enableClerk ? {content} : content} } export default MyApp