mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 10:21:15 +01:00
More theme stuff
This commit is contained in:
@@ -1,17 +1,8 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import type { Appearance } from '../lib/theme/window';
|
||||
import { getPreferredAppearance, subscribeToPreferredAppearanceChange } from '../lib/theme/window';
|
||||
import { usePreferredAppearance } from './usePreferredAppearance';
|
||||
import { useSettings } from './useSettings';
|
||||
|
||||
export function useResolvedAppearance() {
|
||||
const [preferredAppearance, setPreferredAppearance] = useState<Appearance>(
|
||||
getPreferredAppearance(),
|
||||
);
|
||||
|
||||
// Set appearance when preferred theme changes
|
||||
useEffect(() => {
|
||||
return subscribeToPreferredAppearanceChange(setPreferredAppearance);
|
||||
}, []);
|
||||
const preferredAppearance = usePreferredAppearance();
|
||||
|
||||
const settings = useSettings();
|
||||
const appearance =
|
||||
@@ -19,5 +10,7 @@ export function useResolvedAppearance() {
|
||||
? preferredAppearance
|
||||
: settings.appearance;
|
||||
|
||||
console.log('HELLO', settings?.appearance, preferredAppearance);
|
||||
|
||||
return appearance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user