update: theme switcher button use new generalized button

This commit is contained in:
rasmusq
2025-12-19 23:35:43 +01:00
parent cb4539a982
commit 8f574380ce
2 changed files with 12 additions and 3 deletions

View File

@@ -31,6 +31,6 @@
{/if}
<div class="ml-auto flex items-center gap-1 sm:gap-2">
<LanguageToggle {color} />
<ThemeToggle />
<ThemeToggle size="sm" {color} />
</div>
</nav>

View File

@@ -2,13 +2,22 @@
import { themeStore } from '$lib/stores/theme.svelte';
import { Button } from '$lib/components/ui/button';
import { Sun, Moon, Monitor } from 'lucide-svelte';
import IconButton from '../IconButton.svelte';
let {
color = $bindable(null),
size = 'sm',
}: {
color: string | null;
size?: 'sm' | 'md' | 'lg';
} = $props();
function toggle() {
themeStore.toggle();
}
</script>
<Button onclick={toggle} variant="ghost" size="icon" class="rounded-full">
<IconButton onclick={toggle} {size} {color}>
{#if themeStore.current === 'light'}
<Sun size={20} />
<span class="sr-only">Light mode (click for dark)</span>
@@ -19,4 +28,4 @@
<Monitor size={20} />
<span class="sr-only">System mode (click for light)</span>
{/if}
</Button>
</IconButton>