fix: reset faq search with every new search, improve legibility
closes #86965w98m
This commit is contained in:
+4
-5
@@ -21,11 +21,10 @@ export default class extends Controller {
|
||||
}
|
||||
const pattern = new RegExp(value, 'i')
|
||||
this.entryTargets.forEach(entry => {
|
||||
const question = entry.childNodes[0].textContent
|
||||
const answer = entry.childNodes[1].textContent
|
||||
if (!question.match(pattern) && !answer.match(pattern)) {
|
||||
entry.classList.add('hidden')
|
||||
}
|
||||
const question = entry.querySelector('button span').textContent
|
||||
const answer = entry.querySelector('[data-rte-content]').textContent
|
||||
const matches = question.match(pattern) || answer.match(pattern)
|
||||
entry.classList.toggle('hidden', !matches)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<f:if condition="{faqs}">
|
||||
<div class="bg-winter my-4">
|
||||
<div class="bg-ep-primary/80 sbw:bg-sbw-primary/80 uch:bg-uch-primary/80 ser:bg-ser-primary/80 py-8">
|
||||
<div class="bg-ep-primary/90 sbw:bg-sbw-primary/90 uch:bg-uch-primary/90 ser:bg-ser-primary/90 py-8">
|
||||
<div class="container"
|
||||
data-controller="faq">
|
||||
<span class="headline--3 text-white uppercase mb-4">
|
||||
@@ -28,7 +28,7 @@
|
||||
data-faq-target="entry">
|
||||
<button type="button"
|
||||
aria-label="Antwort anzeigen/ausblenden"
|
||||
class="uppercase text-lg text-white flex items-center space-x-4"
|
||||
class="text-lg md:text-xl text-white flex items-center space-x-4"
|
||||
data-action="collapse#toggle">
|
||||
{ep:icon(icon: 'chevron-right', class: 'w-4 h-4 text-white transition-transform duration-200 ease-in-out', data: '{collapse-target: \'icon\'}')}
|
||||
<span class="text-left">
|
||||
|
||||
Reference in New Issue
Block a user