diff options
author | Aryess <yoann.celton@gmail.com> | 2021-10-12 11:28:41 +1100 |
---|---|---|
committer | Aryess <yoann.celton@gmail.com> | 2021-10-12 11:37:24 +1100 |
commit | 5db2414d052af629e2848f53ce9c2e0e686eefaf (patch) | |
tree | 99e332d6481ecd777dfc3b1223dce4dc8dd01c68 /src/components | |
parent | c72acd57d0a61632b6c03e2d9c7321e25dc611fa (diff) | |
download | homer-5db2414d052af629e2848f53ce9c2e0e686eefaf.tar.gz homer-5db2414d052af629e2848f53ce9c2e0e686eefaf.tar.zst homer-5db2414d052af629e2848f53ce9c2e0e686eefaf.zip |
Fix #121 - Change default theme and layout from config
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/DarkMode.vue | 14 | ||||
-rw-r--r-- | src/components/SettingToggle.vue | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/components/DarkMode.vue b/src/components/DarkMode.vue index 80491fa..677238a 100644 --- a/src/components/DarkMode.vue +++ b/src/components/DarkMode.vue | |||
@@ -15,6 +15,9 @@ | |||
15 | <script> | 15 | <script> |
16 | export default { | 16 | export default { |
17 | name: "Darkmode", | 17 | name: "Darkmode", |
18 | props: { | ||
19 | defaultValue: String, | ||
20 | }, | ||
18 | data: function () { | 21 | data: function () { |
19 | return { | 22 | return { |
20 | isDark: null, | 23 | isDark: null, |
@@ -30,6 +33,17 @@ export default { | |||
30 | if ("overrideDark" in localStorage) { | 33 | if ("overrideDark" in localStorage) { |
31 | // Light theme is 1 and Dark theme is 2 | 34 | // Light theme is 1 and Dark theme is 2 |
32 | this.mode = JSON.parse(localStorage.overrideDark) ? 2 : 1; | 35 | this.mode = JSON.parse(localStorage.overrideDark) ? 2 : 1; |
36 | } else { | ||
37 | switch (this.defaultValue) { | ||
38 | case "light": | ||
39 | this.mode = 1; | ||
40 | break; | ||
41 | case "dark": | ||
42 | this.mode = 2; | ||
43 | break; | ||
44 | default: | ||
45 | this.mode = 0; | ||
46 | } | ||
33 | } | 47 | } |
34 | this.isDark = this.getIsDark(); | 48 | this.isDark = this.getIsDark(); |
35 | this.$emit("updated", this.isDark); | 49 | this.$emit("updated", this.isDark); |
diff --git a/src/components/SettingToggle.vue b/src/components/SettingToggle.vue index 985ca84..6c8a10f 100644 --- a/src/components/SettingToggle.vue +++ b/src/components/SettingToggle.vue | |||
@@ -12,6 +12,7 @@ export default { | |||
12 | name: String, | 12 | name: String, |
13 | icon: String, | 13 | icon: String, |
14 | iconAlt: String, | 14 | iconAlt: String, |
15 | defaultValue: Boolean, | ||
15 | }, | 16 | }, |
16 | data: function () { | 17 | data: function () { |
17 | return { | 18 | return { |
@@ -24,6 +25,8 @@ export default { | |||
24 | 25 | ||
25 | if (this.name in localStorage) { | 26 | if (this.name in localStorage) { |
26 | this.value = JSON.parse(localStorage[this.name]); | 27 | this.value = JSON.parse(localStorage[this.name]); |
28 | } else { | ||
29 | this.value = this.defaultValue; | ||
27 | } | 30 | } |
28 | 31 | ||
29 | this.$emit("updated", this.value); | 32 | this.$emit("updated", this.value); |