blog-fs/pages/_app.tsx

36 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-05-02 10:42:38 +08:00
import "../styles/globals.css";
2021-05-01 18:34:45 +08:00
import "tailwindcss/tailwind.css";
2021-05-02 10:42:38 +08:00
import React from "react";
import { GlobalSidebar } from "../components/layouts/global-sidebar";
import styles from "./_app.module.css";
import { ApolloProvider } from "@apollo/client";
2021-05-02 20:04:54 +08:00
import { useApollo } from "../commons/graphql/client";
import { ThemeProvider, useTheme } from '../commons/theme';
2021-07-03 11:25:14 +08:00
import { SwitchTheme } from "../components/switch-theme";
2021-05-01 17:33:49 +08:00
function MyApp({ Component, pageProps }) {
2021-05-02 20:04:54 +08:00
const apolloClient = useApollo(pageProps);
2021-05-01 23:10:28 +08:00
return (
2021-05-02 20:04:54 +08:00
<ApolloProvider client={apolloClient}>
<ThemeProvider>
<div className={styles.page}>
<GlobalSidebar className={styles.sidebar} />
<div className={styles.primary}>
<header className={styles.pageHeader}>
<h1>{"Ivan Li 的个人博客"}</h1>
<div className={styles.actions}>
<SwitchTheme />
</div>
</header>
<div className={styles.wrapper}>
<Component {...pageProps} />
2021-05-02 10:42:38 +08:00
</div>
</div>
</div>
2021-05-02 20:04:54 +08:00
</ThemeProvider>
2021-05-02 10:42:38 +08:00
</ApolloProvider>
2021-05-01 23:10:28 +08:00
);
2021-05-01 17:33:49 +08:00
}
2021-05-02 10:42:38 +08:00
export default MyApp;