fix theme change

This commit is contained in:
Timothy 2021-01-10 14:39:42 +08:00
parent 07faf4dd00
commit 49a558d5ff
2 changed files with 10 additions and 12 deletions

View File

@ -6,19 +6,20 @@ import { DefaultSeo } from 'next-seo'
import Head from 'next/head'
import SEO from '@/components/SEO'
import LayoutWrapper from '@/components/LayoutWrapper'
import MDXComponents from '@/components/MDXComponents'
export default function App({ Component, pageProps }) {
return (
<ThemeProvider attribute="class">
<MDXProvider components={MDXComponents}>
<div className="antialiased">
<Head>
<meta content="width=device-width, initial-scale=1" name="viewport" />
</Head>
<DefaultSeo {...SEO} />
<Head>
<meta content="width=device-width, initial-scale=1" name="viewport" />
</Head>
<DefaultSeo {...SEO} />
<LayoutWrapper>
<Component {...pageProps} />
</div>
</LayoutWrapper>
</MDXProvider>
</ThemeProvider>
)

View File

@ -1,5 +1,4 @@
import Document, { Html, Head, Main, NextScript } from 'next/document'
import LayoutWrapper from '@/components/LayoutWrapper'
class MyDocument extends Document {
render() {
return (
@ -54,11 +53,9 @@ class MyDocument extends Document {
crossorigin="anonymous"
></script>
</Head>
<body className="bg-white dark:bg-gray-900 text-black dark:text-white">
<LayoutWrapper>
<Main />
<NextScript />
</LayoutWrapper>
<body className="bg-white text-black dark:bg-gray-900 dark:text-white antialiased">
<Main />
<NextScript />
</body>
</Html>
)