Skip to content

Commit

Permalink
web/SettingsDropdown: add haptics
Browse files Browse the repository at this point in the history
  • Loading branch information
wukko committed Mar 5, 2025
1 parent ef7fc87 commit 6e21fc5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions web/src/components/settings/SettingsDropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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>
Expand Down

0 comments on commit 6e21fc5

Please sign in to comment.