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
|
|
|
|
*/
|
2020-08-05 22:00:55 +02:00
|
|
|
class StaticInfos {
|
2020-07-28 18:17:17 +02:00
|
|
|
#darktheme = true;
|
2020-12-11 18:23:13 +00:00
|
|
|
#viewbinding = () => {console.warn("Viewbinding not set now!")}
|
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?
|
|
|
|
*/
|
2020-07-24 22:47:21 +02:00
|
|
|
isDarkTheme() {
|
2020-07-27 21:14:56 +02:00
|
|
|
return this.#darktheme;
|
2020-07-24 22:47:21 +02:00
|
|
|
};
|
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;
|
|
|
|
}
|
2020-12-11 18:23:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* set the global Viewbinding for the main Navigation
|
|
|
|
* @param cb
|
|
|
|
*/
|
|
|
|
setViewBinding(cb){
|
|
|
|
this.#viewbinding = cb;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* return the Viewbinding for main navigation
|
|
|
|
* @returns {StaticInfos.viewbinding}
|
|
|
|
*/
|
|
|
|
getViewBinding(){
|
|
|
|
return this.#viewbinding;
|
|
|
|
}
|
2020-07-24 22:47:21 +02:00
|
|
|
}
|
|
|
|
|
2020-08-05 22:00:55 +02:00
|
|
|
const GlobalInfos = new StaticInfos();
|
|
|
|
export default GlobalInfos;
|