generated from garronej/ts-ci
-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Showing
3 changed files
with
56 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,56 @@ | ||
import App from "next/app"; | ||
import { useMemo } from "react"; | ||
import Head from "next/head"; | ||
import withDarkMode from "next-dark-mode"; | ||
import type { AppProps } from 'next/app' | ||
import { useDarkMode } from "next-dark-mode"; | ||
import type { EmotionCache } from "@emotion/cache"; | ||
import createCache from "@emotion/cache"; | ||
import { ThemeProvider as MuiThemeProvider } from "@mui/material/styles"; | ||
import { createTheme } from "@mui/material/styles"; | ||
import CssBaseline from "@mui/material/CssBaseline"; | ||
import { CacheProvider } from '@emotion/react'; | ||
|
||
export default withDarkMode(App) | ||
let muiCache: EmotionCache | undefined = undefined; | ||
|
||
export const createMuiCache = () => muiCache = createCache({ "key": "mui", "prepend": true }); | ||
|
||
export function App({ Component, pageProps }: AppProps) { | ||
|
||
const { darkModeActive } = useDarkMode(); | ||
|
||
const theme = useMemo( | ||
() => createTheme({ | ||
"palette": { | ||
"mode": darkModeActive ? "dark" : "light", | ||
"primary": { | ||
"main": "#32CD32" //Limegreen | ||
} | ||
}, | ||
"typography": { | ||
"subtitle2": { | ||
"fontStyle": "italic" | ||
} | ||
} | ||
}), | ||
[darkModeActive] | ||
); | ||
|
||
return ( | ||
<> | ||
<Head> | ||
<title>Create Next App</title> | ||
<meta name="description" content="Generated by create next app" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</Head> | ||
<CacheProvider value={muiCache ?? createMuiCache()}> | ||
<MuiThemeProvider theme={theme}> | ||
<CssBaseline /> | ||
<Component {...pageProps} /> | ||
</MuiThemeProvider> | ||
</CacheProvider> | ||
</> | ||
); | ||
|
||
} | ||
|
||
export default withDarkMode(App); |
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