Make entire collapsible header clickable

- Changed outer div to button element
- Added w-full and text-left classes
- Now click anywhere on header (icon, text, chevron) to expand/collapse
This commit is contained in:
Mario Zechner 2025-10-08 13:44:59 +02:00
parent f646a29d1a
commit 1405c47b50

View file

@ -98,17 +98,15 @@ export function renderCollapsibleHeader(
: "text-foreground"; : "text-foreground";
return html` return html`
<div class="flex items-center justify-between gap-2 text-sm text-muted-foreground"> <button @click=${toggleContent} class="flex items-center justify-between gap-2 text-sm text-muted-foreground w-full text-left hover:text-foreground transition-colors">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
${state === "inprogress" ? statusIcon(Loader, "text-foreground animate-spin") : ""} ${state === "inprogress" ? statusIcon(Loader, "text-foreground animate-spin") : ""}
${statusIcon(toolIcon, toolIconColor)} ${statusIcon(toolIcon, toolIconColor)}
<span>${text}</span> <span>${text}</span>
</div> </div>
<button @click=${toggleContent} class="hover:text-foreground transition-colors"> <span class="inline-block text-muted-foreground" ${ref(chevronRef)}>
<span class="inline-block text-muted-foreground" ${ref(chevronRef)}> ${icon(defaultExpanded ? ChevronDown : ChevronRight, "sm")}
${icon(defaultExpanded ? ChevronDown : ChevronRight, "sm")} </span>
</span> </button>
</button>
</div>
`; `;
} }