mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-24 02:02:35 -04:00
feat: persistent theme selection fallback to prefered theme
This commit is contained in:
parent
d542688664
commit
40e9af06cf
@ -1,5 +1,13 @@
|
||||
import { useStorage, usePreferredDark } from '@vueuse/core';
|
||||
import { defineStore } from 'pinia';
|
||||
import type { Ref } from 'vue';
|
||||
|
||||
export const useStyleStore = defineStore('style', () => ({
|
||||
isDarkTheme: true,
|
||||
}));
|
||||
export const useStyleStore = defineStore('style', {
|
||||
state: () => {
|
||||
const isDark = usePreferredDark();
|
||||
|
||||
return {
|
||||
isDarkTheme: useStorage('useDarkTheme', isDark) as Ref<boolean>,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user