mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-14 20:16:36 +00:00
fix: colorMode flashing issue
This commit is contained in:
parent
86491c66bb
commit
962df8b5a3
2 changed files with 8 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { ChakraProvider } from '@chakra-ui/react';
|
import { ChakraProvider, localStorageManager } from '@chakra-ui/react';
|
||||||
import { AppProps } from 'next/app';
|
import { AppProps } from 'next/app';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { init } from '@socialgouv/matomo-next';
|
import { init } from '@socialgouv/matomo-next';
|
||||||
|
|
@ -20,7 +20,9 @@ export default function App({ Component, pageProps }: AppProps) {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ChakraProvider theme={theme}>
|
// `colorModeManager` added to fix flashing issue
|
||||||
|
// See: https://chakra-ui.com/docs/styled-system/color-mode#add-colormodemanager-optional-for-ssr
|
||||||
|
<ChakraProvider theme={theme} colorModeManager={localStorageManager}>
|
||||||
<Layout>
|
<Layout>
|
||||||
<Component {...pageProps} />
|
<Component {...pageProps} />
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
|
import { ColorModeScript } from '@chakra-ui/react';
|
||||||
import { Html, Head, Main, NextScript } from 'next/document';
|
import { Html, Head, Main, NextScript } from 'next/document';
|
||||||
|
|
||||||
|
import theme from '../theme';
|
||||||
|
|
||||||
export default function Document() {
|
export default function Document() {
|
||||||
return (
|
return (
|
||||||
<Html lang='en'>
|
<Html lang='en'>
|
||||||
|
|
@ -21,6 +24,7 @@ export default function Document() {
|
||||||
</Head>
|
</Head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<ColorModeScript initialColorMode={theme.config.initialColorMode} />
|
||||||
<Main />
|
<Main />
|
||||||
<NextScript />
|
<NextScript />
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue