1
0
mirror of https://github.com/immich-app/immich.git synced 2025-06-27 05:11:11 +02:00

refactor(web): search people (#9082)

* refactor: search people

* fix: test

* fix: timeout

* fix: callbacks

* fix: simplify

* remove unused var

* refactor: rename file

* fix: focus when deleting last character

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
martin
2024-04-29 23:38:15 +02:00
committed by GitHub
parent 72ce81f0c2
commit 5722c830ff
12 changed files with 207 additions and 267 deletions

View File

@ -7,7 +7,7 @@
export let name: string;
export let roundedBottom = true;
export let isSearching: boolean;
export let showLoadingSpinner: boolean;
export let placeholder: string;
const dispatch = createEventDispatcher<{ search: SearchOptions; reset: void }>();
@ -16,6 +16,12 @@
name = '';
dispatch('reset');
};
const handleSearch = (event: KeyboardEvent) => {
if (event.key === 'Enter') {
dispatch('search', { force: true });
}
};
</script>
<div
@ -33,9 +39,10 @@
type="text"
{placeholder}
bind:value={name}
on:keydown={handleSearch}
on:input={() => dispatch('search', { force: false })}
/>
{#if isSearching}
{#if showLoadingSpinner}
<div class="flex place-items-center">
<LoadingSpinner />
</div>