Skip to content

Commit

Permalink
Merge pull request #649 from captain-Akshay/master
Browse files Browse the repository at this point in the history
fix: sistent themeprovider to enable branding theme
  • Loading branch information
MUzairS15 committed Jun 18, 2024
2 parents 162ca61 + c2f82cd commit 15a7282
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 15a7282

Please sign in to comment.