mirror of
				https://github.com/CorentinTh/it-tools.git
				synced 2025-11-04 02:47:00 -05:00 
			
		
		
		
	fix(style): working dark mode persistence
This commit is contained in:
		
							parent
							
								
									765c010700
								
							
						
					
					
						commit
						3ae872847b
					
				@ -1,13 +1,9 @@
 | 
				
			|||||||
import { useStorage, usePreferredDark } from '@vueuse/core';
 | 
					import { useStorage } from '@vueuse/core';
 | 
				
			||||||
import { defineStore } from 'pinia';
 | 
					import { defineStore } from 'pinia';
 | 
				
			||||||
import type { Ref } from 'vue';
 | 
					import type { Ref } from 'vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const useStyleStore = defineStore('style', {
 | 
					export const useStyleStore = defineStore('style', {
 | 
				
			||||||
  state: () => {
 | 
					  state: () => ({
 | 
				
			||||||
    const isDark = usePreferredDark();
 | 
					    isDarkTheme: useStorage('useDarkTheme', false) as Ref<boolean>,
 | 
				
			||||||
 | 
					  }),
 | 
				
			||||||
    return {
 | 
					 | 
				
			||||||
      isDarkTheme: useStorage('useDarkTheme', isDark) as Ref<boolean>,
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user