- fix mutation error
This commit is contained in:
parent
6d0727c67c
commit
afc49aef0f
@ -36,12 +36,14 @@ const generateTheme = (options: {
|
|||||||
themes: ThemeInput[];
|
themes: ThemeInput[];
|
||||||
generateColorShades?: boolean | ShadesOptions;
|
generateColorShades?: boolean | ShadesOptions;
|
||||||
}) => {
|
}) => {
|
||||||
|
let themes = options.themes;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
options.generateColorShades !== undefined &&
|
options.generateColorShades !== undefined &&
|
||||||
options.generateColorShades !== false
|
options.generateColorShades !== false
|
||||||
) {
|
) {
|
||||||
options.themes = options.themes.map((theme) => {
|
themes = themes.map((theme) => {
|
||||||
theme.colors = {
|
const updatedColors = {
|
||||||
...generateShades(
|
...generateShades(
|
||||||
theme.colors,
|
theme.colors,
|
||||||
typeof options.generateColorShades !== "boolean"
|
typeof options.generateColorShades !== "boolean"
|
||||||
@ -51,16 +53,16 @@ const generateTheme = (options: {
|
|||||||
...theme.colors,
|
...theme.colors,
|
||||||
};
|
};
|
||||||
|
|
||||||
return theme;
|
return { ...theme, colors: updatedColors };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const themeRoot = generateThemeRoot({
|
const themeRoot = generateThemeRoot({
|
||||||
properties: { ...options.themes[0].colors },
|
properties: { ...themes[0].colors },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (options.themes.length > 1) {
|
if (themes.length > 1) {
|
||||||
const themeOverrides = options.themes
|
const themeOverrides = themes
|
||||||
.slice(1)
|
.slice(1)
|
||||||
.map((theme) => {
|
.map((theme) => {
|
||||||
const overrideClass = generateThemeOverrideClass({
|
const overrideClass = generateThemeOverrideClass({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user