You've already forked immich
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:
@ -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>
|
||||
|
Reference in New Issue
Block a user