HTMX debounce input things

This commit is contained in:
Simon Martens
2025-02-26 01:09:00 +01:00
parent 3e1f5a2983
commit 8f664d24ca
4 changed files with 35 additions and 29 deletions

View File

@@ -15,8 +15,7 @@
placeholder="Suchbegriff"
x-model="search"
hx-get=""
hx-trigger="input changed delay=500ms, keyup[key=='Enter']"
hx-sync="this:replace"
hx-trigger="input[if: this.value.length >= 3] delay:3000ms, keyup[enter, if: this.value.length >= 2]"
hx-select="#searchresults"
hx-target="#searchresults"
hx-swap="outerHTML"
@@ -24,17 +23,19 @@
{{ if $model.search }}disabled="true"{{ end }} />
</div>
<div id="permalink" class="font-serif ml-3 min-w-7 pb-1">
<tool-tip position="right" x-show="search">
<a
:href="'/personen/?search=' + search"
x-show="search"
class="inline-block px-1
{{- if not $model.search -}}
<tool-tip position="right" x-show="search">
<a
:href="'/personen/?search=' + search"
x-show="search"
class="inline-block px-1
text-white no-underline bg-stone-700 hover:bg-stone-900 rounded"
hx-boost="false">
<i class="ri-links-line"></i
></a>
<div class="data-tip">Link zu dieser Suchanfrage</div>
</tool-tip>
hx-boost="false">
<i class="ri-links-line"></i
></a>
<div class="data-tip">Link zu dieser Suchanfrage</div>
</tool-tip>
{{- end -}}
</div>
</div>
</div>