Skip to content

Commit 3b82aec

Browse files
committed
feat: refactor dark mode toggle functionality in RightButtons component
1 parent df05be8 commit 3b82aec

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/appbar/RightButtons.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ div
55
66
q-btn(v-if="badgesValues.TO_SYNC > 0" icon="mdi-sync" square color="amber-9" size="md" :label="badgesValues.TO_SYNC +' items à Synchroniser'" @click="syncAll")
77
q-btn( icon="mdi-cog" size="md" flat @click="displaySettings")
8-
q-btn( @click="$q.dark.toggle()" flat size="md" icon="mdi-theme-light-dark")
8+
q-btn( @click="toogleDark" flat size="md" icon="mdi-theme-light-dark")
99
q-btn-dropdown(icon="mdi-account-circle-outline" :label="auth?.user?.displayName" round flat size="md")
1010
q-list
1111
q-item.q-pa-none(v-for="button in buttons" :key="button.name")
@@ -87,4 +87,10 @@ async function toggleDebug() {
8787
query,
8888
})
8989
}
90+
const $q = useQuasar()
91+
92+
function toogleDark() {
93+
$q.dark.toggle()
94+
window.sessionStorage.setItem('darkMode', $q.dark.isActive ? 'true' : 'false')
95+
}
9096
</script>

0 commit comments

Comments
 (0)