mirror of
https://github.com/pheralb/svgl.git
synced 2024-12-05 05:42:35 +08:00
⚙️ Listen to search params to clear results
This commit is contained in:
parent
cf2efef10a
commit
82a6dfb097
@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { inputStyles } from '@/ui/styles';
|
||||
import { Command, SearchIcon } from 'lucide-svelte';
|
||||
export let searchTerm: string;
|
||||
@ -24,6 +25,17 @@
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let searchParams = {} as { [key: string]: string };
|
||||
|
||||
$: {
|
||||
if ($page) {
|
||||
searchParams = Object.fromEntries($page.url.searchParams);
|
||||
if (!searchParams?.search) {
|
||||
clearSearch();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="sticky top-[63px] z-50">
|
||||
|
Loading…
Reference in New Issue
Block a user