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…
	
		Reference in New Issue
	
	Block a user