Skip to content

Commit

Permalink
Merge pull request #661 from codeSafari10/formatting
Browse files Browse the repository at this point in the history
fix:  copy before mutating the theme
  • Loading branch information
aabidsofi19 authored Jun 25, 2024
2 parents 827e63d + e00f347 commit b895bcb
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ export const drawerWidth = 240;

export const createCustomTheme = (mode: PaletteMode, brandPalette?: Interactiveness) => {
const basePalette = mode == 'light' ? lightModePalette : darkModePalette;
const themePalette = brandPalette
? Object.assign({}, basePalette, {
background: {
brand: brandPalette
}
})
: basePalette;

const themePalette = {
...basePalette,
background: {
...(basePalette.background || {}),
brand: {
...((basePalette?.background?.brand || {}) as Interactiveness),
...(brandPalette || {})
}
}
};

return createTheme({
palette: {
Expand Down

0 comments on commit b895bcb

Please sign in to comment.