adrema/resources/js/components/page/SearchModal.vue

41 lines
2.0 KiB
Vue
Raw Permalink Normal View History

2024-01-29 01:37:28 +01:00
<template>
2024-07-03 17:20:47 +02:00
<div class="fixed z-40 top-0 left-0 w-full h-full flex items-start pt-12 justify-center p-6 bg-black/60" @click.self="emit('close')">
<div class="relative rounded-lg p-4 sm:p-8 shadow-2xl shadow-black border border-sky-700/30 bg-sky-800/10 border-solid w-full max-w-[50rem] overflow-auto backdrop-blur-lg">
2024-01-29 01:37:28 +01:00
<div class="relative">
2024-07-03 17:20:47 +02:00
<input
ref="searchInput"
v-model="searchString"
type="text"
2024-01-29 20:43:10 +01:00
class="w-full px-3 sm:px-5 py-2 sm:py-3 pl-12 sm:pl-16 rounded-xl sm:rounded-2xl border-sky-200/40 text-sky-200 sm:text-xl placeholder-sky-200/40 bg-sky-600/20"
2024-07-03 17:20:47 +02:00
placeholder="Wer suchet, der findet …"
/>
2024-01-29 01:37:28 +01:00
<div class="absolute flex items-center h-full top-0 left-4">
2024-01-29 20:43:10 +01:00
<ui-sprite src="search" class="w-5 h-5 sm:w-7 sm:h-7 text-sky-200/20" />
2024-01-29 01:37:28 +01:00
</div>
</div>
2024-07-03 17:20:47 +02:00
<div v-if="results.hits.length" class="mt-5 sm:mt-10 space-y-2">
2024-07-03 17:43:49 +02:00
<ui-search-result v-for="member in results.hits" :key="member.id" :member="member">
<template #buttons>
<i-link v-tooltip="`Details`" :href="member.links.show" class="inline-flex btn btn-primary btn-sm" @click="emit('close')"><ui-sprite src="eye"></ui-sprite></i-link>
<i-link v-tooltip="`Bearbeiten`" :href="member.links.edit" class="inline-flex btn btn-warning btn-sm" @click="emit('close')"><ui-sprite src="pencil"></ui-sprite></i-link>
</template>
</ui-search-result>
2024-01-29 01:37:28 +01:00
</div>
</div>
</div>
</template>
2024-07-03 17:20:47 +02:00
<script lang="js" setup>
2024-07-03 17:31:06 +02:00
import { ref, onMounted } from 'vue';
2024-01-29 01:37:28 +01:00
import useSearch from '../../composables/useSearch.js';
const emit = defineEmits(['close']);
2024-07-03 17:31:06 +02:00
const { searchString, results } = useSearch(null, { limit: 10 });
2024-01-29 01:37:28 +01:00
const searchInput = ref(null);
onMounted(() => {
searchInput.value.focus();
});
</script>