feat: highlight current format in dropdown

This commit is contained in:
Maya 2025-07-25 14:18:37 +03:00
parent c336d7d7a7
commit 608b7e7e70
No known key found for this signature in database
2 changed files with 17 additions and 16 deletions

View File

@ -8,6 +8,7 @@
type Props = {
categories: Categories;
from?: string;
selected?: string;
onselect?: (option: string) => void;
disabled?: boolean;
@ -15,6 +16,7 @@
let {
categories,
from,
selected = $bindable(""),
onselect,
disabled,
@ -109,9 +111,9 @@
const clickDropdown = () => {
open = !open;
if (open) {
if (!open) return;
setTimeout(() => {
if (dropdownMenu) {
if (!dropdownMenu) return;
const searchInput = dropdownMenu.querySelector(
"#format-search",
) as HTMLInputElement;
@ -119,9 +121,7 @@
searchInput.focus();
searchInput.select();
}
}
}, 0); // let dropdown open first
}
};
onMount(() => {
@ -252,7 +252,8 @@
class="w-full p-2 text-center rounded-xl
{format === selected
? 'bg-accent text-black'
: 'hover:bg-panel'}"
: 'hover:bg-panel'}
{format === from ? 'bg-separator' : ''}"
onclick={() => selectOption(format)}
>
{format}

View File

@ -13,7 +13,6 @@
showGradient,
vertdLoaded,
} from "$lib/store/index.svelte";
import { addToast } from "$lib/store/ToastProvider";
import { VertFile } from "$lib/types";
import {
AudioLines,
@ -247,6 +246,7 @@
>
<FormatDropdown
{categories}
from={file.from}
bind:selected={file.to}
onselect={(option) => handleSelect(option, file)}
/>