mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 08:41:37 +00:00
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import 'styles/globals.css';
|
|
import type { AppProps } from 'next/app';
|
|
import { NextPage } from 'next';
|
|
import { ReactElement, ReactNode } from 'react';
|
|
import Head from 'next/head';
|
|
|
|
type NextPageWithLayout = NextPage & {
|
|
getLayout?: (page: ReactElement) => ReactNode;
|
|
};
|
|
type AppPropsWithLayout = AppProps & {
|
|
Component: NextPageWithLayout;
|
|
};
|
|
|
|
function MyApp({ Component, pageProps }: AppPropsWithLayout) {
|
|
const getLayout = Component.getLayout ?? ((page) => page);
|
|
|
|
return (
|
|
<>
|
|
<Head>
|
|
<link rel="shortcut icon" href="/images/img/favicon.webp" />
|
|
<meta name="keywords" content="Blog RUA" />
|
|
<meta name="description" content="Personal blog." />
|
|
<meta name="author" content="Arthur,i@rua.plus" />
|
|
<script
|
|
dangerouslySetInnerHTML={{
|
|
__html: `
|
|
if (
|
|
localStorage.getItem('rua-theme') === 'dark' ||
|
|
(!('rua-theme' in localStorage) &&
|
|
window.matchMedia('(prefers-color-scheme: dark)').matches)
|
|
) {
|
|
document.documentElement.classList.add('dark');
|
|
localStorage.setItem('rua-theme', 'dark');
|
|
} else {
|
|
document.documentElement.classList.remove('dark');
|
|
localStorage.setItem('rua-theme', 'light');
|
|
}`,
|
|
}}
|
|
/>
|
|
<title>RUA</title>
|
|
</Head>
|
|
|
|
{getLayout(<Component {...pageProps} />)}
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default MyApp;
|