Skip to content

Commit

Permalink
fix: sistent themeprovider to enable branding theme
Browse files Browse the repository at this point in the history
Signed-off-by: captain-Akshay <[email protected]>
  • Loading branch information
captain-Akshay committed Jun 12, 2024
1 parent 162ca61 commit c2f82cd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/theme/ThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EmotionCache } from '@emotion/react';
import { CssBaseline, PaletteMode, Theme, ThemeProvider } from '@mui/material';
import { CssBaseline, Interactiveness, PaletteMode, Theme, ThemeProvider } from '@mui/material';
import React from 'react';
import { createCustomTheme } from './theme';

Expand All @@ -13,15 +13,19 @@ export interface SistentThemeProviderProps {
children: React.ReactNode;
emotionCache?: EmotionCache;
initialMode?: PaletteMode;
customTheme?: Interactiveness;
}

function SistentThemeProvider({
children,
emotionCache,
initialMode = 'light'
initialMode = 'light',
customTheme
}: SistentThemeProviderProps): JSX.Element {
const theme = React.useMemo<Theme>(() => createCustomTheme(initialMode), [initialMode]);

if (customTheme) {
theme.palette.background.brand = customTheme;
}
return (
<SistentThemeProviderContext.Provider value={{ emotionCache }}>
<ThemeProvider theme={theme}>
Expand All @@ -38,7 +42,6 @@ export function SistentThemeProviderWithoutBaseLine({
initialMode = 'light'
}: SistentThemeProviderProps): JSX.Element {
const theme = React.useMemo<Theme>(() => createCustomTheme(initialMode), [initialMode]);

return (
<SistentThemeProviderContext.Provider value={{ emotionCache }}>
<ThemeProvider theme={theme}>{children}</ThemeProvider>
Expand Down

0 comments on commit c2f82cd

Please sign in to comment.