mirror of
https://github.com/wukko/cobalt.git
synced 2025-04-30 06:24:25 +02:00
web/SettingsDropdown: add haptics
This commit is contained in:
parent
ef7fc8781b
commit
6e21fc56eb
@ -8,6 +8,7 @@
|
|||||||
import { updateSetting } from "$lib/state/settings";
|
import { updateSetting } from "$lib/state/settings";
|
||||||
import type { CobaltSettings } from "$lib/types/settings";
|
import type { CobaltSettings } from "$lib/types/settings";
|
||||||
|
|
||||||
|
import { hapticConfirm, hapticSwitch } from "$lib/haptics";
|
||||||
import IconSelector from "@tabler/icons-svelte/IconSelector.svelte";
|
import IconSelector from "@tabler/icons-svelte/IconSelector.svelte";
|
||||||
|
|
||||||
export let title: string;
|
export let title: string;
|
||||||
@ -22,8 +23,9 @@
|
|||||||
export let disabled = false;
|
export let disabled = false;
|
||||||
|
|
||||||
const onChange = (event: Event) => {
|
const onChange = (event: Event) => {
|
||||||
const target = event.target as HTMLSelectElement;
|
hapticConfirm();
|
||||||
|
|
||||||
|
const target = event.target as HTMLSelectElement;
|
||||||
updateSetting({
|
updateSetting({
|
||||||
[settingContext]: {
|
[settingContext]: {
|
||||||
[settingId]: target.value,
|
[settingId]: target.value,
|
||||||
@ -46,13 +48,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</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}
|
{#each Object.keys(items) as value, i}
|
||||||
<option {value} selected={selectedOption === value}>
|
<option {value} selected={selectedOption === value}>
|
||||||
{items[value]}
|
{items[value]}
|
||||||
</option>
|
</option>
|
||||||
{#if i === 0}
|
{#if i === 0}
|
||||||
<hr>
|
<hr />
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user