fix: add onchange for Communities TextInput

This allows the user to simply enter in their filter and press enter,
rather than having to press the "Search" button.
This commit is contained in:
Peter Bui committed 2023-07-25 17:09:05 -04:00
1 parent 59e42add1c
commit fda05d200e
2 files changed
+9 -1

No files matched your search

@@ -38,6 +38,7 @@
bind:value bind:value
on:keydown={(e) => dispatcher('keydown', e)} on:keydown={(e) => dispatcher('keydown', e)}
on:input={(e) => dispatcher('input', e)} on:input={(e) => dispatcher('input', e)}
on:change={(e) => dispatcher('change', e)}
{...$$restProps} {...$$restProps}
class={className} class={className}
{required} {required}
+8 -1
View File
@@ -37,7 +37,14 @@
}} }}
/> />
<div class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center"> <div class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center">
<TextInput bind:value={search} /> <TextInput bind:value={search}
on:change={() => {
$page.url.searchParams.set('q', search)
goto($page.url.toString(), {
invalidateAll: true,
})
}}
/>
<Button <Button
on:click={() => { on:click={() => {
$page.url.searchParams.set('q', search) $page.url.searchParams.set('q', search)