mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-21 23:36:15 -04:00
feat: persistent theme selection fallback to prefered theme
This commit is contained in:
parent
d542688664
commit
40e9af06cf
1 changed files with 11 additions and 3 deletions
|
@ -1,5 +1,13 @@
|
||||||
|
import { useStorage, usePreferredDark } from '@vueuse/core';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
import type { Ref } from 'vue';
|
||||||
|
|
||||||
export const useStyleStore = defineStore('style', () => ({
|
export const useStyleStore = defineStore('style', {
|
||||||
isDarkTheme: true,
|
state: () => {
|
||||||
}));
|
const isDark = usePreferredDark();
|
||||||
|
|
||||||
|
return {
|
||||||
|
isDarkTheme: useStorage('useDarkTheme', isDark) as Ref<boolean>,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue