mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-07 03:13:30 +00:00
* Generalizing filesystem jobs to accept multiple files at once * Some small changes and fixing front * Enable rename route to replicate Finder's behavior * Assign tag to multiple objects at once * Remove from recents accepting multiple files * Fixing some warnings * Adding multiple files feature to Open and Open With * Conditional stuff for macos * Generating commands.ts and other minor warnings * Rust fmt * TS typecheck * Rust format and TS typecheck * Requested changes * Requested changes --------- Co-authored-by: Utku <74243531+utkubakir@users.noreply.github.com>
26 lines
690 B
TypeScript
26 lines
690 B
TypeScript
import { useEffect, useState } from 'react';
|
|
import { useThemeStore } from '@sd/client';
|
|
|
|
//this hook is being used for some ui elements & icons that need to be inverted
|
|
|
|
export function useIsDark(): boolean {
|
|
const themeStore = useThemeStore();
|
|
const [isDark, setIsDark] = useState(themeStore.theme === 'dark');
|
|
|
|
useEffect(() => {
|
|
if (themeStore.syncThemeWithSystem) {
|
|
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
setIsDark(true);
|
|
} else setIsDark(false);
|
|
} else {
|
|
if (themeStore.theme === 'dark') {
|
|
setIsDark(true);
|
|
} else if (themeStore.theme === 'vanilla') {
|
|
setIsDark(false);
|
|
}
|
|
}
|
|
}, [setIsDark, themeStore]);
|
|
|
|
return isDark;
|
|
}
|