mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-09 18:53:38 +02:00
Add React hooks eslint
This commit is contained in:
@@ -13,16 +13,12 @@ export function useTheme() {
|
||||
defaultValue: getAppearance(),
|
||||
});
|
||||
|
||||
const themeChange = (appearance: Appearance) => {
|
||||
appearanceKv.set(appearance);
|
||||
};
|
||||
|
||||
const handleToggleAppearance = async () => {
|
||||
appearanceKv.set(appearanceKv.value === 'dark' ? 'light' : 'dark');
|
||||
};
|
||||
|
||||
// Set appearance when preferred theme changes
|
||||
useEffect(() => subscribeToPreferredAppearanceChange(themeChange), []);
|
||||
useEffect(() => subscribeToPreferredAppearanceChange(appearanceKv.set), [appearanceKv.set]);
|
||||
|
||||
// Sync appearance when k/v changes
|
||||
useEffect(() => setAppearance(appearanceKv.value), [appearanceKv.value]);
|
||||
|
||||
Reference in New Issue
Block a user