stadtratmonitor-vue/src/components/SearchBar.vue

51 lines
1.5 KiB
Vue
Raw Normal View History

2023-06-07 17:31:37 +02:00
<script lang="ts">
2023-06-07 22:12:45 +02:00
export default {
2023-06-14 18:12:42 +02:00
updated() {
this.$emit('searchQuery', this.search.value)
},
2023-06-07 22:12:45 +02:00
data() {
return {
2023-06-14 18:12:42 +02:00
search: {
value: '',
type: '',
},
2023-06-07 22:12:45 +02:00
}
2023-06-14 18:12:42 +02:00
},
methods: {
submit(type: string) {
this.search.type = type
this.$emit('searchSubmit', this.search.type)
}
},
2023-06-07 22:12:45 +02:00
}
2023-06-07 17:31:37 +02:00
</script>
<template>
2023-06-16 15:27:12 +02:00
<form class="sticky top-0 flex flex-row place-content-center">
2023-06-14 18:12:42 +02:00
<div class="flex flex-row w-full max-w-5xl">
<input
2023-06-16 21:09:51 +02:00
class="p-6 grow bg-transparent placeholder:text-text-300 dark:placeholder:text-text-700 text-2xl text-center focus-visible:outline focus-visible:outline-current"
2023-06-14 18:12:42 +02:00
type="search"
2023-06-16 21:08:16 +02:00
placeholder="z. B. Thema, Name, VII-EF-08640, …"
2023-06-14 18:12:42 +02:00
v-model="search.value"
@keyup.alt.enter.exact="submit('assist')"
@keyup.enter.exact="submit('filter')"
/>
<div class="flex flex-row p-4 place-content-center">
<button
2023-06-16 15:27:12 +02:00
class="py-2 px-4 bg-primary-button-500 hover:bg-primary-button-600 rounded-l-lg text-white"
2023-06-14 18:12:42 +02:00
@click.prevent="submit('filter')"
aria-keyshortcuts="Enter"
2023-06-16 15:25:01 +02:00
>Suchen
2023-06-14 18:12:42 +02:00
</button>
<button
2023-06-16 15:27:12 +02:00
class="py-2 px-4 bg-secondary-button-500 hover:bg-secondary-button-600 rounded-r-lg text-white"
2023-06-14 18:12:42 +02:00
@click.prevent="submit('assist')"
aria-keyshortcuts="Alt+Enter"
title="Tastenkürzel: Alt + Enter"
2023-06-16 15:25:01 +02:00
>Fragen
2023-06-14 18:12:42 +02:00
</button>
</div>
</div>
2023-06-11 16:50:44 +02:00
</form>
2023-06-07 17:31:37 +02:00
</template>