Files
gpx.studio/website/src/lib/components/ModeSwitch.svelte

24 lines
560 B
Svelte
Raw Normal View History

2024-07-05 01:02:53 +02:00
<script lang="ts">
import { Button } from '$lib/components/ui/button';
import { Moon, Sun } from 'lucide-svelte';
2025-06-08 16:32:41 +02:00
import { mode, setMode } from 'mode-watcher';
import { _ } from '$lib/i18n';
2024-07-05 01:02:53 +02:00
export let size = '20';
2024-07-05 01:02:53 +02:00
</script>
2024-07-07 18:26:52 +02:00
<Button
variant="ghost"
class="h-8 px-1.5 {$$props.class ?? ''}"
on:click={() => {
2025-06-08 16:32:41 +02:00
setMode(mode.current === 'light' ? 'dark' : 'light');
}}
aria-label={$_('menu.mode')}
2024-07-07 18:26:52 +02:00
>
2025-06-08 16:32:41 +02:00
{#if mode.current === 'light'}
<Sun {size} />
{:else}
<Moon {size} />
{/if}
2024-07-07 18:26:52 +02:00
</Button>