Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion app/components/Header/SearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ const showSearchBar = computed(() => {
})

const { model: searchQuery, startSearch } = useGlobalSearch('header')
const hasSearchQuery = computed(() => searchQuery.value.trim().length > 0)

function handleSubmit() {
startSearch()
}

function clearSearch() {
searchQuery.value = ''
inputRef.value?.focus()
}

// Expose focus method for parent components
const inputRef = useTemplateRef('inputRef')
function focus() {
Expand Down Expand Up @@ -52,11 +58,20 @@ defineExpose({ focus })
name="q"
:placeholder="$t('search.placeholder')"
no-correct
class="w-full min-w-25 ps-7"
class="w-full min-w-25 ps-7 pe-8"
@focus="isSearchFocused = true"
@blur="isSearchFocused = false"
size="small"
/>
<button
v-if="hasSearchQuery"
type="button"
:aria-label="$t('common.close')"
Comment thread
ghostdevv marked this conversation as resolved.
Outdated
class="absolute inset-ie-2 inline-flex h-6 w-6 items-center justify-center rounded text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"
@click="clearSearch"
>
<span class="i-lucide:circle-x h-4 w-4" aria-hidden="true" />
</button>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
<button type="submit" class="sr-only">{{ $t('search.button') }}</button>
</div>
</div>
Expand Down
Loading