use theme switcher from UI lib

This commit is contained in:
bwees 2025-05-26 14:14:59 -05:00
parent 4b2a8ea97d
commit 22e9d8ec6d
No known key found for this signature in database

View File

@ -1,21 +1,13 @@
<script lang="ts"> <script lang="ts">
import { Theme } from '$lib/constants';
import { themeManager } from '$lib/managers/theme-manager.svelte'; import { themeManager } from '$lib/managers/theme-manager.svelte';
import { IconButton } from '@immich/ui'; import { ThemeSwitcher } from '@immich/ui';
import { mdiWeatherNight, mdiWhiteBalanceSunny } from '@mdi/js';
import { t } from 'svelte-i18n';
let icon = $derived(themeManager.isDark ? mdiWhiteBalanceSunny : mdiWeatherNight);
</script> </script>
{#if !themeManager.theme.system} {#if !themeManager.theme.system}
<IconButton <ThemeSwitcher
aria-label={$t('toggle_theme')} size="medium"
{icon}
role="switch"
aria-checked={themeManager.isDark ? 'true' : 'false'}
onclick={() => themeManager.toggleTheme()}
color="secondary" color="secondary"
variant="ghost" onChange={(theme) => themeManager.setTheme(theme == 'dark' ? Theme.DARK : Theme.LIGHT)}
shape="round"
/> />
{/if} {/if}