~james/core

core/web/src/lib/components/settings/ThemeOption.svelte -rw-r--r-- 745 bytes
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 15 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script lang="ts">
	import DropdownItem from "#lib/components/ui/DropdownItem.svelte";
	import ThemeChip from "#lib/components/settings/ThemeChip.svelte";
	import Check from "$icon/check";
	import { themeLabel, type Theme } from "#lib/theme.ts";

	interface Props {
		theme: Theme;
		selected?: boolean;
		onselect?: (theme: Theme) => void;
	}

	let { theme, selected = false, onselect }: Props = $props();
</script>

<DropdownItem class="[&>span]:w-full" onclick={() => onselect?.(theme)}>
	<span class="flex w-full items-center gap-xs">
		<ThemeChip {theme} />
		<span class="flex-1">{themeLabel(theme)}</span>
		{#if selected}
			<Check class="size-3.5 shrink-0 text-foreground-default" aria-hidden="true" />
		{/if}
	</span>
</DropdownItem>