refactor(web): unify the competing head-row patterns (.section-head vs .card-head) onto shared components #280
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab#280
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Split out of umbrella #276 (frontend component reuse, follow-up to #275).
The frontend has two competing head-row patterns: page-level
.section-head(shell.css — an<h2>plus optional inline controls, hand-rolled in ~13 route files) and card-level.card-head(cards.css — title + spacer + action). #275 extractedSectionCard, whose head (.card-head.section-card-head) already owns the head/hint/body spacing contract for settings-style section cards, and cards.css deliberately mirrors.section-head h2sizing to keep the two rows visually aligned — duplication the CSS itself comments on.Unify head-row markup onto shared components so the row's markup and spacing live in one place. The agent brief follows in a comment.
Agent Brief
Category: enhancement
Summary: One shared implementation of the "heading + right-aligned action" head row; page-level and card-level heads stop hand-rolling it.
Current behavior:
Two competing patterns render the same visual row. Page-level heads use
.section-head— an<h2>plus optional inline controls — hand-rolled in the list routes (Repos, History, Tokens, Credentials, RepoIssues, RepoCRs), the detail routes, and both settings shells. Card-level heads use.card-head.SectionCard(from #275) already owns the card-level head for settings-style section cards, including the spacing contract: the component owns all spacing between head row, hint, and body, and call sites must not re-add margins. Everywhere else the row is hand-rolled, and the two CSS classes duplicate near-identical sizing rules with cross-referencing comments ("mirrors.section-head h2").Desired behavior:
Head-row markup is produced by shared components only:
SectionCardwhere the head belongs to a card section — card sections that hand-roll a.card-headwith an<h2>migrate to it where the full card shape fits.SectionHead) for page-level heads that are not cards: heading, always-present spacer, optional action/controls slot (History's filter select, for example, must fit).The #275 spacing contract extends to the page-level head: the component owns the gap, call sites add no margins around it. The rendered look is unchanged.
Key interfaces:
SectionCard— the existing exemplar; do not change its public props for this issueSectionHead(or similar) component owning the page-level head row, with the same always-present-spacer trick so markup is identical with and without an action.section-head/.card-headCSS rules — consolidate sizing rules that the unification makes redundant, without visual change; the invariant "the row's height must never depend on whether an action is present" must keep holding for both head kindsAcceptance criteria:
.section-headrender through the shared componentOut of scope:
.card-title(TokenCard-style rows) — that's the list-row family under #276