This commit is contained in:
Thomas Chartron 2021-11-06 19:20:43 +01:00
parent 8186339244
commit 50478b093c
2 changed files with 22 additions and 4 deletions

View file

@ -1,7 +1,14 @@
document.addEventListener("DOMContentLoaded", function() {
search();
let search_input = document.getElementById('search').addEventListener('click', openSearch)
// search();
});
function search() {
function openSearch() {
console.log("open modal")
let search_modal = document.getElementById('search-modal');
console.log(search_modal)
}
function search() {
let index = elasticlunr.Index.load(window.searchIndex);
}

View file

@ -59,12 +59,22 @@
</div>
</div>
{% if config.extra.zt.enable_search %}
<!-- Search input in navbar -->
<div class="flex ml-auto relative items-center">
<input id="search" class="rounded-xl border border-black h-9" type="text" >
<input id="search" class="rounded-xl border border-black h-9" type="text">
<svg class="w-6 h-6 absolute right-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
</svg>
</div>
<!-- Search box modal -->
<div id="search-modal" class="hidden w-16 h-14 flex">
<!-- Search input -->
<input id="search-input" class="rounded-xl border border-black h-9" type="text">
<!-- Search results -->
<div class="flex flex-col gap-y-4 border border-black max-h-2xl">
</div>
</div>
{% endif %}
</div>
<div class="absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0">
@ -172,6 +182,7 @@
<!------------------------- SCRIPTS ------------------------->
<script defer src="/js/main.js"></script>
{% if config.extra.zt.enable_search %}
<script defer src="/elasticlunr.min.js"></script>
<script defer src="/js/search.js"></script>
{% endif %}
</body>