🚧 WIP - working on the custom theme feature

This commit is contained in:
Alicia Sykes
2021-07-11 20:52:12 +01:00
parent c7d91bed94
commit 65aa971099
11 changed files with 142 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
import ConfigAccumulator from '@/utils/ConfigAccumalator';
import { visibleComponents } from '@/utils/defaults';
import { visibleComponents, localStorageKeys, theme as defaultTheme } from '@/utils/defaults';
/**
* Initiates the Accumulator class and generates a complete config object
@@ -40,3 +40,14 @@ export const componentVisibility = (appConfig) => {
? !usersChoice.hideSplashScreen : visibleComponents.splashScreen,
};
};
/**
* Gets the users saved theme, first looks for local storage theme,
* then looks at user's appConfig, and finally checks the defaults
* @returns {string} Name of theme to apply
*/
export const getTheme = () => {
const localTheme = localStorage[localStorageKeys.THEME];
const appConfigTheme = config.appConfig.theme;
return localTheme || appConfigTheme || defaultTheme;
};