1
1
import { EmotionCache } from '@emotion/react' ;
2
- import { CssBaseline , PaletteMode , Theme , ThemeProvider } from '@mui/material' ;
2
+ import { CssBaseline , Interactiveness , PaletteMode , Theme , ThemeProvider } from '@mui/material' ;
3
3
import React from 'react' ;
4
4
import { createCustomTheme } from './theme' ;
5
5
@@ -13,15 +13,19 @@ export interface SistentThemeProviderProps {
13
13
children : React . ReactNode ;
14
14
emotionCache ?: EmotionCache ;
15
15
initialMode ?: PaletteMode ;
16
+ customTheme ?: Interactiveness ;
16
17
}
17
18
18
19
function SistentThemeProvider ( {
19
20
children,
20
21
emotionCache,
21
- initialMode = 'light'
22
+ initialMode = 'light' ,
23
+ customTheme
22
24
} : SistentThemeProviderProps ) : JSX . Element {
23
25
const theme = React . useMemo < Theme > ( ( ) => createCustomTheme ( initialMode ) , [ initialMode ] ) ;
24
-
26
+ if ( customTheme ) {
27
+ theme . palette . background . brand = customTheme ;
28
+ }
25
29
return (
26
30
< SistentThemeProviderContext . Provider value = { { emotionCache } } >
27
31
< ThemeProvider theme = { theme } >
@@ -38,7 +42,6 @@ export function SistentThemeProviderWithoutBaseLine({
38
42
initialMode = 'light'
39
43
} : SistentThemeProviderProps ) : JSX . Element {
40
44
const theme = React . useMemo < Theme > ( ( ) => createCustomTheme ( initialMode ) , [ initialMode ] ) ;
41
-
42
45
return (
43
46
< SistentThemeProviderContext . Provider value = { { emotionCache } } >
44
47
< ThemeProvider theme = { theme } > { children } </ ThemeProvider >
0 commit comments