Kairo-Jinkendo/frontend/src/components/CollapsibleSection.jsx
Lars 252b3f05f2
Some checks failed
Test Suite / lint-backend (push) Waiting to run
Test Suite / compose-smoke (push) Waiting to run
Test Suite / k6 /api/health Baseline (push) Blocked by required conditions
Test Suite / playwright-smoke (push) Blocked by required conditions
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Has been cancelled
feat(AP1.9d, AP2.2d): Work-Default-UI, Sprint-Planung und Composition Work-Slots
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 18:05:15 +02:00

56 lines
1.3 KiB
JavaScript

import { useState } from 'react'
/**
* Generischer Drill-down-Container — AP1.9d Anti-Todo-Wand.
* Bewusst layout-neutral für späteres UI-Redesign.
*/
export function CollapsibleSection({
title,
lead,
defaultCollapsed = true,
expandLabel = 'Alle anzeigen',
collapseLabel = 'Einklappen',
headerActions = null,
className = 'card',
children,
}) {
const [expanded, setExpanded] = useState(!defaultCollapsed)
return (
<section className={className}>
<div className="section-header">
<div>
{title && <h2>{title}</h2>}
{lead && <p className="section-lead muted">{lead}</p>}
</div>
{headerActions}
</div>
{expanded ? (
<>
{children}
<p className="collapsible-section__toggle">
<button
type="button"
className="btn btn-ghost btn-sm"
onClick={() => setExpanded(false)}
>
{collapseLabel}
</button>
</p>
</>
) : (
<p className="collapsible-section__toggle">
<button
type="button"
className="btn btn-secondary btn-sm"
onClick={() => setExpanded(true)}
>
{expandLabel}
</button>
</p>
)}
</section>
)
}