Files
dragonroll/frontend/app/components/viewer/topbar/TopSearchBar.vue
2026-04-20 20:30:42 +02:00

110 lines
2.8 KiB
Vue

<script setup>
import SearchIcon from 'pixelarticons/svg/search.svg'
/*
import { ref, onMounted } from 'vue';
import { GetArrayContent, GetContent } from '@/services/Content';
import useEmitter from '@/services/Emitter';
const emitter = useEmitter();
import NoteSearchElement from "@/components/topbar/NoteSearchElement.vue";
let noteLinks = ref([]);
let searchContainer = ref(null);
emitter.on("hide-search-container", () => {
searchContainer.value.style.display = "none";
})
function updateList(event){
let content = GetArrayContent();
let query = "";
if(event !== undefined) query = event.target.value;
let filter = query.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toUpperCase().trim();
noteLinks.value = content.filter((noteInfo) => {
return noteInfo["title"].normalize("NFD").replace(/[\u0300-\u036f]/g, "").toUpperCase().indexOf(filter) > -1;
});
}
function searchFocus(event){
if(GetContent() === undefined) return;
searchContainer.value.style.display = "";
updateList(undefined);
}
onMounted(() => {
});
*/
</script>
<template>
<div class="top-search-container">
<div class="top-search-box">
<img class="icon search-icon" :src="SearchIcon" alt="My Happy SVG"/>
<!-- <input type="text" v-on:input="updateList" v-on:focus="searchFocus" class="search-prompt" placeholder="Buscar...">-->
<input type="text" class="search-prompt" placeholder="Buscar...">
</div>
<!-- <div class="search-container" ref="searchContainer" v-on:focusout="searchFocusout" style="display: none;">-->
<div class="search-container" style="display: none;">
<div class="search-container-list">
<!--
<NoteSearchElement v-for="element in noteLinks" :key="element.key" :title="element.title" :link="element.key"></NoteSearchElement>
-->
</div>
</div>
</div>
</template>
<style scoped>
.top-search-container {
height: 100%;
align-items: center;
display: flex;
}
.top-search-box {
align-items: center;
display: flex;
background-color: var(--search-background);
padding: 2px;
border-radius: 5px;
}
.search-prompt {
border: none;
padding: 5px;
width: 30vw;
max-width: 400px;
background: none;
margin-left: -5px;
}
.search-prompt:focus {
outline: none;
}
.search-icon {
padding: 5px;
}
.search-container {
position: absolute;
background-color: var(--search-background-container);
top: 45px;
margin-left: auto;
margin-right: auto;
max-width: 800px;
max-height: 500px;
overflow-y: scroll;
left: 0;
right: 0;
backdrop-filter: blur(15px);
border-radius: 10px;
min-width: 400px;
min-height: 500px;
z-index: 99999;
}
</style>