diff --git a/web/src/lib/components/elements/dropdown.svelte b/web/src/lib/components/elements/dropdown.svelte
index b0d5646cde..b6b7a17b49 100644
--- a/web/src/lib/components/elements/dropdown.svelte
+++ b/web/src/lib/components/elements/dropdown.svelte
@@ -4,13 +4,12 @@
import { clickOutside } from '$lib/utils/click-outside';
import { fly } from 'svelte/transition';
import type Icon from 'svelte-material-icons/DotsVertical.svelte';
+ import { createEventDispatcher } from 'svelte';
- interface DropdownOption {
- value: string;
- icon?: Icon;
- }
-
- export let options: DropdownOption[] | string[] = [];
+ const dispatch = createEventDispatcher<{
+ select: string;
+ }>();
+ export let options: string[];
export let value = options[0];
export let icons: (typeof Icon)[] | undefined = undefined;
@@ -21,7 +20,12 @@
};
const handleSelectOption = (index: number) => {
- value = options[index];
+ if (options[index] === value) {
+ dispatch('select', value);
+ } else {
+ value = options[index];
+ }
+
showMenu = false;
};
@@ -36,7 +40,7 @@
{#if icon}
{value}
diff --git a/web/src/lib/components/elements/table-header.svelte b/web/src/lib/components/elements/table-header.svelte new file mode 100644 index 0000000000..c89bff3db2 --- /dev/null +++ b/web/src/lib/components/elements/table-header.svelte @@ -0,0 +1,29 @@ + + +Cover
+ {:else} +List
+ {/if} +