From ae8d62958bdf0e61498a32d0a8e49bfddf338b6d Mon Sep 17 00:00:00 2001 From: Tai Groot Date: Mon, 26 Oct 2020 03:01:39 -0700 Subject: [PATCH] feat: adds support for vlayout config option --- src/App.vue | 3 ++- src/components/DarkMode.vue | 4 ++-- src/components/LayoutToggle.vue | 24 ++++++++++++++---------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/App.vue b/src/App.vue index 3568c35..1397e73 100644 --- a/src/App.vue +++ b/src/App.vue @@ -31,6 +31,7 @@ - - + + @@ -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); }, }, };