Skip to content

Fix labs header details alignment - #14539

Merged
cemms1 merged 5 commits into
mainfrom
cemms1/fix-labs-header-details-alignment
Sep 23, 2025
Merged

cemms1 merged 5 commits into
mainfrom
cemms1/fix-labs-header-details-alignment

Conversation

@cemms1

@cemms1 cemms1 commented Sep 22, 2025

Copy link
Copy Markdown
Contributor

What does this change?

Follows-up on #14532 to tweak the position of the opened details component depending on the current viewport size. We now position it as left: 0 for wider breakpoints (leftCol + wide) and right: 0 for narrower ones (mobile -> desktop). This ensures it does not overflow the left side of the page when used on a front.

Also updates the Storybook story to bring it closer to how it looks when included in the FrontSection component. There is a separate story in FrontSection to show how this looks within this component

Note

As in #14532, the background colour of the container and cards is to be updated separately

Additional changes

  • Allows the Storybook split theme decorator to omit the format headings from the story
    • Formats are only used for articles and have no relevance to fronts, tag pages or other non-article pages. Including the format for these stories adds extra noise since these should always fall back to the default format.

Why?

Ensuring the details component opens in a sensible position when used within the new LabsSectionHeader component.

Screenshots

Before After
before after

@github-actions

github-actions Bot commented Sep 22, 2025

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Sep 22, 2025

Copy link
Copy Markdown

@cemms1 cemms1 Sep 22, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds hideFormatHeading arg to the Split Theme decorator to allow omission of the format heading for non article stories

Optional arg and defaults to false so will not have an impact on any existing stories

@cemms1
cemms1 force-pushed the cemms1/fix-labs-header-details-alignment branch from fd346aa to 37487ec Compare September 22, 2025 13:56
Comment on lines +21 to +27
margin: 20px auto 100px;
min-width: 320px;
${from.leftCol} {
min-width: auto;
max-width: 260px;
height: 400px;
}

@cemms1 cemms1 Sep 22, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Centres the story and restricts the space available to bring it closer to how it looks when used inside the FrontSection container

Comment on lines +85 to +91
const positionStyles = css`
right: 0;
${from.leftCol} {
left: 0;
right: auto;
}
`;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main fix in this PR is to adjust the positioning of the opened details element

@cemms1
cemms1 marked this pull request as ready for review September 22, 2025 14:02
@cemms1
cemms1 requested a review from a team as a code owner September 22, 2025 14:02
@cemms1
cemms1 requested a review from a team September 22, 2025 14:02
@github-actions

Copy link
Copy Markdown

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

Base automatically changed from cemms1/labs-redesign-header to main September 23, 2025 09:51
…mat heading on the split theme decorator for this story

- allow details to open to left side on mobile and tablet screens and right side on desktop
- add additional parameter to the SplitTheme decorator to allow omission of the format heading since this isn't relevant outside of articles
@cemms1
cemms1 force-pushed the cemms1/fix-labs-header-details-alignment branch from 37487ec to e9ea4c8 Compare September 23, 2025 10:28
@cemms1 cemms1 added the run_chromatic Runs chromatic when label is applied label Sep 23, 2025
@github-actions github-actions Bot removed the run_chromatic Runs chromatic when label is applied label Sep 23, 2025
@cemms1
cemms1 merged commit e7e3eaf into main Sep 23, 2025
31 checks passed
@cemms1
cemms1 deleted the cemms1/fix-labs-header-details-alignment branch September 23, 2025 14:09
@gu-prout

gu-prout Bot commented Sep 23, 2025

Copy link
Copy Markdown

Seen on PROD (merged by @cemms1 6 minutes and 49 seconds ago) Please check your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants