web/SettingsDropdown: add haptics

This commit is contained in:
wukko 2025-03-05 20:18:52 +06:00
parent ef7fc8781b
commit 6e21fc56eb
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2

View File

@ -8,6 +8,7 @@
import { updateSetting } from "$lib/state/settings";
import type { CobaltSettings } from "$lib/types/settings";
import { hapticConfirm, hapticSwitch } from "$lib/haptics";
import IconSelector from "@tabler/icons-svelte/IconSelector.svelte";
export let title: string;
@ -22,8 +23,9 @@
export let disabled = false;
const onChange = (event: Event) => {
const target = event.target as HTMLSelectElement;
hapticConfirm();
const target = event.target as HTMLSelectElement;
updateSetting({
[settingContext]: {
[settingId]: target.value,
@ -46,13 +48,17 @@
</div>
</div>
<select on:change={e => onChange(e)} {disabled}>
<select
on:click={() => hapticSwitch()}
on:change={(e) => onChange(e)}
{disabled}
>
{#each Object.keys(items) as value, i}
<option {value} selected={selectedOption === value}>
{items[value]}
</option>
{#if i === 0}
<hr>
<hr />
{/if}
{/each}
</select>