Search dialog loading and escape to close
This commit is contained in:
parent
f81453c612
commit
95621c936d
1 changed files with 12 additions and 3 deletions
|
|
@ -80,6 +80,14 @@
|
||||||
doSearch(term, controller)
|
doSearch(term, controller)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The modal container ignores Escape inside a text field, so the focused search input has to
|
||||||
|
// close the modal itself
|
||||||
|
const onKeyDown = (event: KeyboardEvent) => {
|
||||||
|
if (event.key === "Escape") {
|
||||||
|
popModal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const getAgeSection = (createdAt: number) => {
|
const getAgeSection = (createdAt: number) => {
|
||||||
const age = now() - createdAt
|
const age = now() - createdAt
|
||||||
|
|
||||||
|
|
@ -125,7 +133,8 @@
|
||||||
class="min-w-0 grow"
|
class="min-w-0 grow"
|
||||||
type="text"
|
type="text"
|
||||||
{placeholder}
|
{placeholder}
|
||||||
oninput={onInput} />
|
oninput={onInput}
|
||||||
|
onkeydown={onKeyDown} />
|
||||||
</label>
|
</label>
|
||||||
{#if term}
|
{#if term}
|
||||||
{#if people.length > 0}
|
{#if people.length > 0}
|
||||||
|
|
@ -135,9 +144,9 @@
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
{#if loading}
|
{#if loading}
|
||||||
<Spinner {loading}>Searching...</Spinner>
|
<Spinner {loading} class="justify-center py-12">Searching...</Spinner>
|
||||||
{:else if results.length === 0 && people.length === 0}
|
{:else if results.length === 0 && people.length === 0}
|
||||||
<Spinner {loading}>No results found.</Spinner>
|
<Spinner {loading} class="justify-center py-12">No results found.</Spinner>
|
||||||
{:else}
|
{:else}
|
||||||
{#each eventsByAge as [key, events] (key)}
|
{#each eventsByAge as [key, events] (key)}
|
||||||
<p class="text-xs uppercase tracking-wide opacity-60">
|
<p class="text-xs uppercase tracking-wide opacity-60">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue