From 8008e5611ea5c767a3f94eb4ad4d56813637cc00 Mon Sep 17 00:00:00 2001 From: Hugh Kaznowski Date: Mon, 7 Sep 2026 10:41:17 +0100 Subject: [PATCH] Extract shared SectionHeader and FormFooter components (ticket 087) Params/Metrics/Alerts/Dashboards each hand-assembled the same collapsible- section header wiring (role/tabIndex/aria-expanded/onClick/onKeyDown around CollapseToggle+HelpIcon+PopOutButton), and Dashboards duplicated it a second time for its no-active-profile branch. Params/Metrics/Alerts also duplicated the declare/edit form footer (editing banner, submit label toggle, Cancel button). Added SectionHeader and FormFooter to CollapsibleSection.tsx and adopted them at all five call sites; pure extraction, no behavior change. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01TeyhRfMYjMditek6geDRoQ --- webapp/src/components/Alerts.tsx | 46 ++-------- webapp/src/components/CollapsibleSection.tsx | 95 ++++++++++++++++++++ webapp/src/components/Dashboards.tsx | 58 ++++-------- webapp/src/components/Metrics.tsx | 62 ++++--------- webapp/src/components/Params.tsx | 62 ++++--------- 5 files changed, 153 insertions(+), 170 deletions(-) diff --git a/webapp/src/components/Alerts.tsx b/webapp/src/components/Alerts.tsx index c77ab0c..9423fda 100644 --- a/webapp/src/components/Alerts.tsx +++ b/webapp/src/components/Alerts.tsx @@ -9,13 +9,7 @@ import { type AlertRule, type CompareOp, } from '../lib/api' -import { - CollapseToggle, - handleSectionHeaderKeyDown, - sectionHeaderInteractiveClassName, - sectionHeaderLeftClassName, - useSectionCollapsed, -} from './CollapsibleSection' +import { FormFooter, SectionHeader, useSectionCollapsed } from './CollapsibleSection' import { HelpIcon } from './HelpIcon' import { RegexHelpIcon } from './RegexHelpIcon' import { queryInputClassName } from './FilterBar' @@ -238,22 +232,7 @@ export function Alerts() { return (
-
setCollapsed(!collapsed)} - onKeyDown={handleSectionHeaderKeyDown(() => setCollapsed(!collapsed))} - > -
- Alerts - -
-
- -
-
+ setCollapsed(!collapsed)} />