Files
OpenMediaCenter/src/GlobalInfos.js
T

38 lines
922 B
JavaScript
Raw Normal View History

2020-10-25 18:48:23 +00:00
import darktheme from './AppDarkTheme.module.css';
import lighttheme from './AppLightTheme.module.css';
2020-08-03 23:31:43 +00:00
2020-08-12 17:50:25 +00:00
/**
* This class is available for all components in project
* it contains general infos about app - like theme
*/
class StaticInfos {
2020-07-28 18:17:17 +02:00
#darktheme = true;
2020-07-27 21:14:56 +02:00
2020-08-12 17:50:25 +00:00
/**
* check if the current theme is the dark theme
* @returns {boolean} is dark theme?
*/
isDarkTheme() {
2020-07-27 21:14:56 +02:00
return this.#darktheme;
};
2020-07-27 21:14:56 +02:00
2020-08-12 17:50:25 +00:00
/**
* setter to enable or disable the dark or light theme
* @param enable enable the dark theme?
*/
enableDarkTheme(enable = true) {
2020-07-27 21:14:56 +02:00
this.#darktheme = enable;
}
2020-08-03 23:31:43 +00:00
2020-08-12 17:50:25 +00:00
/**
* get the currently selected theme stylesheet
* @returns {*} the style object of the current active theme
*/
getThemeStyle() {
2020-08-03 23:31:43 +00:00
return this.isDarkTheme() ? darktheme : lighttheme;
}
}
const GlobalInfos = new StaticInfos();
export default GlobalInfos;