-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_app.tsx
40 lines (36 loc) · 1 KB
/
_app.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import {
GeistProvider,
CssBaseline,
useTheme,
GeistUIThemesPalette,
} from "@geist-ui/react"
import { BarPaletteCtx } from "../contexts/app-state"
import { BarColorPalette } from "../types"
function MyApp({ Component, pageProps }) {
const { palette: geistUIPalette } = useTheme()
const barPalette = getBarPalette(geistUIPalette)
return (
<GeistProvider>
<CssBaseline />
<BarPaletteCtx.Provider value={barPalette}>
<Component {...pageProps} />
</BarPaletteCtx.Provider>
</GeistProvider>
)
}
/**
* Get bar color palette from Geist UI's color palette
* @param geistUIPalette Geist UI's color palette
* @returns Bar color palette
*/
const getBarPalette = (geistUIPalette: GeistUIThemesPalette) => {
const barPalette: BarColorPalette = {
compare: geistUIPalette.foreground,
idle: geistUIPalette.accents_4,
correctOrder: geistUIPalette.cyan,
swap: geistUIPalette.success,
wrongOrder: geistUIPalette.error,
}
return barPalette
}
export default MyApp