-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tim Won
committed
Sep 17, 2020
1 parent
0b643bf
commit af75e1a
Showing
6 changed files
with
82 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
import { ThemeProvider, CSSReset } from '@chakra-ui/core'; | ||
import { ThemeProvider, CSSReset, ColorModeProvider } from '@chakra-ui/core'; | ||
import '../styles/global.css'; | ||
import customTheme from '../styles/theme'; | ||
import Router from 'next/router'; | ||
import * as gtag from 'src/lib/gtag'; //https://hoangtrinhj.com/using-google-analytics-with-next-js | ||
import { useState, useEffect } from 'react'; | ||
interface IProps { | ||
[key: string]: any; | ||
} | ||
// Notice how we track pageview when route is changed | ||
Router.events.on('routeChangeComplete', (url) => gtag.pageView(url)); | ||
|
||
export default function App({ Component, pageProps }: IProps) { | ||
export default function App({ Component, pageProps, children }: IProps) { | ||
const [mounted, setMounted] = useState(false); // a hack to fix color mode temporarily | ||
|
||
useEffect(() => { | ||
setMounted(true); | ||
}, []); | ||
|
||
return ( | ||
<ThemeProvider theme={customTheme}> | ||
<CSSReset /> | ||
<Component {...pageProps} /> | ||
<ColorModeProvider> | ||
<CSSReset /> | ||
{mounted && <Component {...pageProps} />} | ||
</ColorModeProvider> | ||
</ThemeProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters