| 1 |
<script lang="ts" generics="T extends string"> |
| 2 |
import type { LocalStoreSyncedStore } from "../lib/store"; |
| 3 |
|
| 4 |
interface Props { |
| 5 |
/** The store to show a switch for. */ |
| 6 |
store: LocalStoreSyncedStore<T>; |
| 7 |
} |
| 8 |
|
| 9 |
let { store }: Props = $props(); |
| 10 |
</script> |
| 11 |
|
| 12 |
<span> |
| 13 |
{#each store.values() as [option, name]} |
| 14 |
<label class="button" class:muted={$store !== option}> |
| 15 |
<input type="radio" bind:group={$store} value={option} /> |
| 16 |
{name} |
| 17 |
</label> |
| 18 |
{/each} |
| 19 |
</span> |
| 20 |
|
| 21 |
<style> |
| 22 |
input { |
| 23 |
display: none; |
| 24 |
} |
| 25 |
|
| 26 |
label + label { |
| 27 |
margin-left: 0.125rem; |
| 28 |
} |
| 29 |
|
| 30 |
@media print { |
| 31 |
label { |
| 32 |
display: none; |
| 33 |
} |
| 34 |
} |
| 35 |
</style> |