mirror of
https://github.com/0PandaDEV/Qopy.git
synced 2025-04-20 12:54:05 +02:00
feat: add TopBar component with search functionality
This commit is contained in:
parent
b96d3c23de
commit
2d3d92f3c8
1 changed files with 55 additions and 0 deletions
55
components/TopBar.vue
Normal file
55
components/TopBar.vue
Normal file
|
@ -0,0 +1,55 @@
|
|||
<template>
|
||||
<div class="topbar">
|
||||
<input
|
||||
ref="searchInput"
|
||||
v-model="searchQuery"
|
||||
@input="onSearch"
|
||||
class="search"
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
spellcheck="false"
|
||||
type="text"
|
||||
placeholder="Type to filter entries..." />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
|
||||
const searchQuery = ref('')
|
||||
const searchInput = ref<HTMLInputElement | null>(null)
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', query: string): void
|
||||
(e: 'focus'): void
|
||||
}>()
|
||||
|
||||
const onSearch = () => {
|
||||
emit('search', searchQuery.value)
|
||||
}
|
||||
|
||||
defineExpose({ searchInput })
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.topbar {
|
||||
width: 100%;
|
||||
height: 56px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-inline: 16px;
|
||||
z-index: 100;
|
||||
|
||||
.search {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 18px;
|
||||
color: var(--text);
|
||||
background-color: transparent;
|
||||
outline: none;
|
||||
border: none;
|
||||
font-family: SFRoundedMedium;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue