22541 extract shared anchor/back breadcrumb helper patterns

This commit is contained in:
2026-04-09 09:45:00 +01:00
parent 30bc729c70
commit e3e893ed58
2 changed files with 96 additions and 84 deletions
+28
View File
@@ -219,6 +219,34 @@ Follow-ups:
- Next slice recommendation: target remaining anchor/back-link duplication (`<a href="#">` and occasional `<a href={...}>`) by introducing a bounded helper for action/back crumbs while preserving existing non-Link semantics.
### CL-22541-H: breadcrumbs anchor/back-link helper consolidation bundle
date: 2026-04-09
author: Cline
scope: `components/breadcrumbs.js`
type: change
rationale: Continue the larger bounded breadcrumbs refactor cadence by extracting repeated anchor/back-link crumb markup into one local helper while preserving non-Link semantics.
impact: Refactor-only JSX deduplication and consistency improvement in breadcrumb rendering; no intended route/auth/session/API/EN-CY/a11y behavior change.
status: completed
Summary:
- Added `renderAnchorCrumb(href, label, onClick, listItemClass)` in `components/breadcrumbs.js` for repeated `<a ...>` breadcrumb actions.
- Replaced repeated anchor/back-link crumb blocks in:
- `/myportal/searchresults` my-portal anchor crumb
- `/newappeal/[appealtypes]` and `/myportal/[appealtypes]` step-back crumbs
- `/myportal/representation` back-chevron action crumbs (all three state branches)
- Preserved original click handlers, href values, and class semantics (`govuk-breadcrumbs__link-item`, `backChevron`) to keep behavior parity.
Validation:
- `npx eslint components/breadcrumbs.js` -> pass.
- `node tests/phase22/index.test.cjs` -> pass (combined suite).
Follow-ups:
- Next slice recommendation: consolidate remaining one-off inline breadcrumb `<li><Link ...>` blocks still present in edge branches (e.g., `/newappeal/[appealtypes]`, `/myportal/[appealtypes]`, `/case`) and consider introducing an optional `renderBackCrumb(...)` semantic wrapper for readability.
### CL-00X: 22500 `components/elements/index.js` Phase 1 helper extraction
date: 2026-04-07