feat: make ContentLayout secondary header breakpoint tunable#4810
Draft
ernst-dev wants to merge 1 commit into
Draft
feat: make ContentLayout secondary header breakpoint tunable#4810ernst-dev wants to merge 1 commit into
ernst-dev wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4810 +/- ##
=======================================
Coverage 97.61% 97.61%
=======================================
Files 952 952
Lines 30816 30820 +4
Branches 11318 11319 +1
=======================================
+ Hits 30081 30085 +4
Misses 688 688
Partials 47 47 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Makes the
ContentLayoutsecondary header (secondaryHeaderslot) responsive breakpoint tunable via a new opt-in, backward-compatiblesecondaryHeaderBreakpointprop.Previously the header/secondary-header split was hardcoded to
{ default: 12, xs: 9 }/{ default: 12, xs: 3 }, so the two slots always collapsed (stacked full-width) below thexsbreakpoint. On narrow-but-not-tiny viewports this collapses earlier than some layouts want, and there was no way for consumers to control it.The new prop lets consumers choose the breakpoint at and above which the header (9 cols) and secondary header (3 cols / 25%) are shown side-by-side. Below the breakpoint they stack full-width, as before.
secondaryHeaderBreakpoint?: 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl'— defaults to'xs'(identical to today's behaviour, fully backward compatible).'xxs'to keep the slots side-by-side on narrow viewports (so they don't collapse too early); raise it ('s','m', …) to make them stack on wider viewports.headerandsecondaryHeaderare set.The grid-definition computation is extracted into a small pure helper (
getSecondaryHeaderGridDefinition) for testability. Reuses the existingInternalGrid+GridProps.BreakpointMappingpatterns; no visual/behavioural change at the default value.Related links, issue #: Cloudscape Core SIM AWSUI-61262 — "Improve service page header responsiveness with ContentLayout". The ticket references
src/content-layout/internal.tsx#L114and asks to make the secondary header better on mid-size screens. This PR addresses that as an opt-in, backward-compatible prop rather than changing the default colspans (which would be a layout-breaking change for existing consumers).How has this been tested?
'xs';getSecondaryHeaderGridDefinitionproduces the correct 9/3 side-by-side split with full-width (12) stacking below the breakpoint for every supported breakpoint; component still renders both header slots when the prop is set. Full ContentLayout suite: 51 passing.documentersnapshot to include the new prop (97 passing).pages/content-layout/secondary-header-breakpoint.page.tsx) with an interactive breakpoint selector over a service-homepage-style layout for manual/visual testing.eslintclean on changed files;gulp quick-buildand productiongulp buildboth succeed.Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md. (New optional prop; default reproduces current behaviour exactly.)CONTRIBUTING.md.Security
checkSafeUrlfunction. (N/A — no URL handling.)Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.