apretar enter en el command de busqueda te manda a la busqueda

This commit is contained in:
2026-01-10 17:30:54 -03:00
parent 1bc1028ab7
commit 502c6711ca
2 changed files with 14 additions and 3 deletions

View File

@@ -20,6 +20,7 @@
import { resolve } from '$app/paths';
import { busquedaHashtags } from '@/hooks/busquedaHashtags';
import Separator from '@/components/ui/separator/separator.svelte';
import { goto } from '$app/navigation';
let search: string = $state('');
let open = $state(false);
@@ -76,6 +77,12 @@
placeholder="Buscar Usuario o Hashtag"
bind:value={search}
oninput={buscar}
onkeydown={(e) => {
if (e.key === 'Enter') {
open = false;
goto(resolve(`/search/${encodeURIComponent(search)}`));
}
}}
/>
{#if search}
<ul class="m-2 space-y-2">