Merge remote-tracking branch 'origin/main' into refactor/ui

This commit is contained in:
liyasthomas
2021-07-08 13:44:00 +05:30
18 changed files with 346 additions and 52 deletions

View File

@@ -21,36 +21,34 @@
</div>
</template>
<script>
import { getLocalConfig, setLocalConfig } from "~/newstore/localpersistence"
<script lang="ts">
import Vue from "vue"
import {
HoppAccentColors,
HoppAccentColor,
getSettingSubject,
settingsStore,
applySetting,
} from "~/newstore/settings"
export default {
export default Vue.extend({
data() {
return {
active: getLocalConfig("THEME_COLOR") || "green",
accentColors: [
"blue",
"green",
"teal",
"indigo",
"purple",
"orange",
"pink",
"red",
"yellow",
],
accentColors: HoppAccentColors,
active: settingsStore.value.THEME_COLOR,
}
},
watch: {
active(color) {
setLocalConfig("THEME_COLOR", color)
},
subscriptions() {
return {
active: getSettingSubject("THEME_COLOR"),
}
},
methods: {
setActiveColor(color) {
setActiveColor(color: HoppAccentColor) {
document.documentElement.setAttribute("data-accent", color)
this.active = color
applySetting("THEME_COLOR", color)
},
},
}
})
</script>

View File

@@ -15,15 +15,31 @@
</div>
</template>
<script>
export default {
<script lang="ts">
import Vue from "vue"
import {
applySetting,
getSettingSubject,
HoppBgColor,
HoppBgColors,
} from "~/newstore/settings"
export default Vue.extend({
data() {
return {
colors: ["system", "light", "dark", "black"],
colors: HoppBgColors,
}
},
subscriptions() {
return {
activeColor: getSettingSubject("BG_COLOR"),
}
},
methods: {
getIcon(color) {
setBGMode(color: HoppBgColor) {
applySetting("BG_COLOR", color)
},
getIcon(color: HoppBgColor) {
switch (color) {
case "system":
return "desktop_windows"
@@ -38,5 +54,5 @@ export default {
}
},
},
}
})
</script>