1
0
mirror of https://github.com/taigrr/homer synced 2025-01-18 04:53:12 -08:00

feat: adds support for vlayout config option

This commit is contained in:
Tai Groot 2020-10-26 03:01:39 -07:00
parent 729d1b5309
commit ae8d62958b
Signed by: taigrr
GPG Key ID: D00C269A87614812
3 changed files with 18 additions and 13 deletions

View File

@ -31,6 +31,7 @@
<DarkMode :isDark="this.isDark" @updated="isDark = $event" />
<LayoutToggle
:vlayout="this.vlayout"
@updated="vlayout = $event"
name="vlayout"
icon="fa-list"
@ -145,7 +146,7 @@ export default {
offline: false,
services: null,
showMenu: false,
vlayout: true,
vlayout: null,
};
},
created: async function () {

View File

@ -13,7 +13,7 @@ export default {
name: "Darkmode",
props: ["isDark"],
created: function () {
var isDark =
let isDark =
"overrideDark" in localStorage
? JSON.parse(localStorage.overrideDark)
: this.isDark === null
@ -23,7 +23,7 @@ export default {
},
methods: {
toggleTheme: function () {
var isDark = !this.isDark;
let isDark = !this.isDark;
localStorage.overrideDark = isDark;
this.$emit("updated", isDark);
},

View File

@ -1,6 +1,6 @@
<template>
<a v-on:click="toggleSetting()" class="navbar-item is-inline-block-mobile">
<span><i :class="['fas', 'fa-fw', value ? icon : secondaryIcon]"></i></span>
<a v-on:click="toggleLayout()" class="navbar-item is-inline-block-mobile">
<span><i :class="['fas', 'fa-fw', vlayout ? icon : secondaryIcon]"></i></span>
<slot></slot>
</a>
</template>
@ -12,27 +12,31 @@ export default {
name: String,
icon: String,
iconAlt: String,
vlayout: Boolean,
},
data: function () {
return {
secondaryIcon: null,
value: true,
};
},
created: function () {
this.secondaryIcon = this.iconAlt || this.icon;
let vlayout;
if (this.name in localStorage) {
this.value = JSON.parse(localStorage[this.name]);
vlayout = JSON.parse(localStorage[this.name]);
} else {
vlayout = this.vlayout === null
? true
: this.vlayout;
}
this.$emit("updated", this.value);
this.$emit("updated", vlayout);
},
methods: {
toggleSetting: function () {
this.value = !this.value;
localStorage[this.name] = this.value;
this.$emit("updated", this.value);
toggleLayout: function () {
let vlayout = !this.vlayout;
localStorage[this.name] = vlayout;
this.$emit("updated", vlayout);
},
},
};