[enh][m]: update theme (#40)
This commit is contained in:
@@ -1,11 +1,23 @@
|
||||
/* istanbul ignore file */
|
||||
import '../styles/index.css';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import { ApolloProvider } from '@apollo/react-hooks';
|
||||
import { useApollo } from '../lib/apolloClient';
|
||||
import { DEFAULT_THEME } from '../themes';
|
||||
import { applyTheme } from '../themes/utils';
|
||||
|
||||
import './App.css';
|
||||
|
||||
export default function MyApp({ Component, pageProps }) {
|
||||
const apolloClient = useApollo(pageProps.initialApolloState);
|
||||
const [theme, setTheme] = useState(DEFAULT_THEME);
|
||||
|
||||
useEffect(() => {
|
||||
/**
|
||||
* We can switch theme.
|
||||
* e.g. setTheme('primary');
|
||||
* */
|
||||
|
||||
applyTheme(theme);
|
||||
}, [theme]);
|
||||
|
||||
return (
|
||||
<ApolloProvider client={apolloClient}>
|
||||
|
||||
Reference in New Issue
Block a user