]> git.immae.eu Git - github/bastienwirtz/homer.git/blobdiff - src/components/SettingToggle.vue
Merge pull request #139 from Genymobile/update-deps-and-fix-code-styles
[github/bastienwirtz/homer.git] / src / components / SettingToggle.vue
index 94655bcab19aa06eb33dc54e93b4456e2720b26b..985ca84f8f0c6344fa01395b062c8a72eb9599d3 100644 (file)
@@ -1,7 +1,6 @@
 <template>
   <a v-on:click="toggleSetting()" class="navbar-item is-inline-block-mobile">
-    <span v-show="value"><i :class="['fas', icon]"></i></span>
-    <span v-show="!value"><i :class="['fas', iconAlt]"></i></span>
+    <span><i :class="['fas', 'fa-fw', value ? icon : secondaryIcon]"></i></span>
     <slot></slot>
   </a>
 </template>
@@ -16,13 +15,12 @@ export default {
   },
   data: function () {
     return {
+      secondaryIcon: null,
       value: true,
     };
   },
   created: function () {
-    if (!this.iconAlt) {
-      this.iconAlt = this.icon;
-    }
+    this.secondaryIcon = this.iconAlt || this.icon;
 
     if (this.name in localStorage) {
       this.value = JSON.parse(localStorage[this.name]);