fix(dark-mode): apply custom theme to light mode

This commit is contained in:
vincentbpro 2022-03-01 14:50:22 +01:00
parent 471b5f3efc
commit 9282276320
2 changed files with 4 additions and 8 deletions

View File

@ -1,7 +1,6 @@
import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import { lightTheme } from '@strapi/design-system/themes';
import cloneDeep from 'lodash/cloneDeep';
import merge from 'lodash/merge';
import pick from 'lodash/pick';
import isFunction from 'lodash/isFunction';
@ -35,7 +34,7 @@ class StrapiApp {
locales: ['en'],
menuLogo: MenuLogo,
notifications: { releases: true },
themes: { light: lightTheme, dark: darkTheme, custom: null },
themes: { light: lightTheme, dark: darkTheme },
translations: {},
tutorials: true,
};
@ -227,10 +226,7 @@ class StrapiApp {
}
if (this.customConfigurations?.theme) {
this.configurations.themes.custom = merge(
cloneDeep(this.configurations.themes.light),
this.customConfigurations.theme
);
merge(this.configurations.themes.light, this.customConfigurations.theme);
}
if (this.customConfigurations?.notifications?.releases !== undefined) {

View File

@ -293,13 +293,13 @@ describe('ADMIN | StrapiApp', () => {
it('should override the theme', () => {
const adminConfig = {
config: { theme: { main: { colors: { red: 'black' } } } },
config: { theme: { colors: { red: 'black' } } },
};
const app = StrapiApp({ middlewares, reducers, library, adminConfig });
app.createCustomConfigurations();
expect(app.configurations.themes.custom.main.colors.red).toBe('black');
expect(app.configurations.themes.light.colors.red).toBe('black');
});
it('should override the tutorials', () => {