11<script setup lang="ts">
2+ import { debounce } from ' perfect-debounce'
3+
24withDefaults (
35 defineProps <{
46 showLogo? : boolean
@@ -22,13 +24,17 @@ const showSearchBar = computed(() => {
2224 return route .name !== ' search' && route .name !== ' index'
2325})
2426
25- async function handleSearchInput() {
27+ const debouncedNavigate = debounce ( async () => {
2628 const query = searchQuery .value .trim ()
2729 await router .push ({
2830 name: ' search' ,
2931 query: query ? { q: query } : undefined ,
3032 })
3133 searchQuery .value = ' '
34+ }, 100 )
35+
36+ async function handleSearchInput() {
37+ debouncedNavigate ()
3238}
3339
3440onKeyStroke (' ,' , e => {
@@ -45,10 +51,10 @@ onKeyStroke(',', e => {
4551
4652<template >
4753 <header
48- aria-label =" Site header"
54+ : aria-label =" $t(' header.site_header') "
4955 class =" sticky top-0 z-50 bg-bg/80 backdrop-blur-md border-b border-border"
5056 >
51- <nav aria-label =" Main navigation " class =" container h-14 flex items-center" >
57+ <nav : aria-label =" $t('nav.main_navigation') " class =" container h-14 flex items-center" >
5258 <!-- Left: Logo -->
5359 <div class =" flex-shrink-0" >
5460 <NuxtLink
@@ -94,7 +100,6 @@ onKeyStroke(',', e => {
94100 :placeholder =" $t('search.placeholder')"
95101 v-bind =" noCorrect"
96102 class =" w-full bg-bg-subtle border border-border rounded-md pl-7 pr-3 py-1.5 font-mono text-sm text-fg placeholder:text-fg-subtle transition-border-color duration-300 motion-reduce:transition-none focus:border-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50"
97- autocomplete =" off"
98103 @input =" handleSearchInput"
99104 @focus =" isSearchFocused = true"
100105 @blur =" isSearchFocused = false"
0 commit comments