summaryrefslogtreecommitdiffstatshomepage
path: root/frontend/src/lib/toolbar/Search.svelte
blob: d5971bcc89b12ea5bd0a236c740599b52956d96a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<script lang="ts">
	import { page } from '$app/state';
	import { debounce } from '$lib/Actions';
	import { accelerator } from '$lib/Shortcuts';

	interface Props {
		name: string;
		field: string;
		filter: { apply: (params: URLSearchParams) => void };
	}

	let { name, field = $bindable(), filter }: Props = $props();
</script>

<input
	type="text"
	size={25}
	class="btn-slate w-min"
	placeholder="Search {name}..."
	bind:value={field}
	use:debounce={{ callback: () => filter.apply(page.url.searchParams) }}
	use:accelerator={'q'}
/>