1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 15:16:40 -04:00

use the excellent next-themes module

This commit is contained in:
2022-01-06 10:08:24 -05:00
parent 6b756a54c1
commit 3394cac5de
11 changed files with 36 additions and 97 deletions

View File

@ -1,9 +1,8 @@
import { useEffect } from "react";
import { useRouter } from "next/router";
import Script from "next/script";
import { ThemeProvider } from "next-themes";
import { DefaultSeo, SocialProfileJsonLd } from "next-seo";
import * as Fathom from "fathom-client";
import { restoreThemeScript } from "../lib/restore-theme";
import * as config from "../lib/config";
import type { AppProps } from "next/app";
@ -51,10 +50,6 @@ const App = ({ Component, pageProps }: AppProps) => {
return (
<>
<Script id="restore_theme" strategy="afterInteractive">
{restoreThemeScript}
</Script>
{/* @ts-ignore */}
<DefaultSeo
defaultTitle={`${config.siteName} ${config.shortDescription}`}
@ -186,7 +181,9 @@ const App = ({ Component, pageProps }: AppProps) => {
]}
/>
<Component {...pageProps} />
<ThemeProvider>
<Component {...pageProps} />
</ThemeProvider>
</>
);
};

View File

@ -12,10 +12,7 @@ class MyDocument extends Document {
render() {
return (
<Html lang={config.siteLocale?.replace("_", "-")}>
<Head>
{/* set dynamically by script in _app.tsx, but tag must exist first */}
<meta name="theme-color" content="" />
</Head>
<Head />
<body>
<Main />
<NextScript />