Update to use existing compiled classes

This commit is contained in:
Alex Haslam committed 2026-01-31 20:18:41 +00:00
1 parent 82a593e0ed
commit 7a9baa1c50
2 files changed
+24 -29

No files matched your search

+17
View File
@@ -4,3 +4,20 @@
<div id="{{ $id }}" class="space-y-2" data-accordion="{{ $mode }}">
{{- .Inner -}}
</div>
{{ if eq $mode "collapse" }}
<script>
(() => {
const root = document.getElementById("{{ $id }}");
if (!root) return;
const items = root.querySelectorAll("details[data-accordion-item]");
items.forEach((item) => {
item.addEventListener("toggle", () => {
if (!item.open) return;
items.forEach((other) => {
if (other !== item) other.removeAttribute("open");
});
});
});
})();
</script>
{{ end }}