Spaces:
Runtime error
Runtime error
Ashhar
commited on
Commit
·
afcd851
1
Parent(s):
9e31351
make dark theme as default
Browse files- app/lib/stores/theme.ts +4 -4
app/lib/stores/theme.ts
CHANGED
@@ -9,16 +9,16 @@ export function themeIsDark() {
|
|
9 |
return themeStore.get() === 'dark';
|
10 |
}
|
11 |
|
12 |
-
export const DEFAULT_THEME = '
|
13 |
|
14 |
export const themeStore = atom<Theme>(initStore());
|
15 |
|
16 |
-
function initStore() {
|
17 |
if (!import.meta.env.SSR) {
|
18 |
-
const persistedTheme = localStorage.getItem(kTheme) as Theme | undefined;
|
19 |
const themeAttribute = document.querySelector('html')?.getAttribute('data-theme');
|
20 |
|
21 |
-
return persistedTheme ??
|
22 |
}
|
23 |
|
24 |
return DEFAULT_THEME;
|
|
|
9 |
return themeStore.get() === 'dark';
|
10 |
}
|
11 |
|
12 |
+
export const DEFAULT_THEME = 'dark';
|
13 |
|
14 |
export const themeStore = atom<Theme>(initStore());
|
15 |
|
16 |
+
function initStore(): Theme {
|
17 |
if (!import.meta.env.SSR) {
|
18 |
+
const persistedTheme = localStorage.getItem(kTheme) || (DEFAULT_THEME as Theme | undefined);
|
19 |
const themeAttribute = document.querySelector('html')?.getAttribute('data-theme');
|
20 |
|
21 |
+
return (persistedTheme ?? themeAttribute) as Theme;
|
22 |
}
|
23 |
|
24 |
return DEFAULT_THEME;
|