Skip to content

Use grid module for StandardLayout, introduce vertical rules#15428

Open
frederickobrien wants to merge 14 commits intomainfrom
grid-api-for-standard-layout
Open

Use grid module for StandardLayout, introduce vertical rules#15428
frederickobrien wants to merge 14 commits intomainfrom
grid-api-for-standard-layout

Conversation

@frederickobrien
Copy link
Contributor

@frederickobrien frederickobrien commented Feb 25, 2026

What does this change and why?

This refactors the StandardLayout to use the grid module, hopefully making it easier to reason with and style. This is with one eye on header standardisation work by @guardian/articles-and-publishing as well as a potential revamp of the interactive layout (see #15358).

As part of this I've had a stab at introducing verticalRules to the grid module, allowing for lines to be added if they're wanted. After a few iterations I've made this something that's pure CSS and baked into the grid module itself. verticalRules adds outer borders, while verticalRules({ centre: true }) adds an additional one to the left hand side of the centre column.

This wound up being almost exactly the same amount of code but I think the outcome is good, with the beefed up grid module being something that could be applied to other layouts going forward.

A glimpse of the sorts of things this could enable: #15509

Context

Examples of different layouts

Standard

Showcase

Screenshots

Before After
image image
image image
image image

@frederickobrien frederickobrien self-assigned this Feb 25, 2026
@frederickobrien frederickobrien added the maintenance Departmental tracking: maintenance work, not a fix or a feature label Feb 25, 2026
@frederickobrien frederickobrien added this to the Visuals milestone Feb 25, 2026
@frederickobrien frederickobrien force-pushed the grid-api-for-standard-layout branch from c8e046d to b0f4bf5 Compare February 25, 2026 16:56
@github-actions
Copy link

github-actions bot commented Feb 25, 2026

@frederickobrien frederickobrien changed the title Use Grid API for StandardLayout Use grid API for StandardLayout Feb 25, 2026
@frederickobrien frederickobrien force-pushed the grid-api-for-standard-layout branch from bb14535 to b752a6f Compare February 27, 2026 14:21
@github-actions
Copy link

github-actions bot commented Feb 27, 2026

@frederickobrien frederickobrien changed the title Use grid API for StandardLayout Use grid module for StandardLayout, introduce vertical rules Feb 27, 2026
@frederickobrien frederickobrien force-pushed the grid-api-for-standard-layout branch 3 times, most recently from ab9a1c2 to 0646448 Compare March 3, 2026 12:27
@frederickobrien frederickobrien marked this pull request as ready for review March 3, 2026 12:27
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

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.

@frederickobrien frederickobrien force-pushed the grid-api-for-standard-layout branch from 81a91f8 to e67e85c Compare March 3, 2026 14:32
@frederickobrien frederickobrien force-pushed the grid-api-for-standard-layout branch 3 times, most recently from 2357924 to cf39bf7 Compare March 6, 2026 13:03
@frederickobrien frederickobrien added the run_chromatic Runs chromatic when label is applied label Mar 6, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Mar 6, 2026
@frederickobrien frederickobrien force-pushed the grid-api-for-standard-layout branch 2 times, most recently from cbee04b to 12ef9bb Compare March 10, 2026 10:28
@frederickobrien frederickobrien added the run_chromatic Runs chromatic when label is applied label Mar 10, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Mar 10, 2026
@frederickobrien frederickobrien force-pushed the grid-api-for-standard-layout branch 2 times, most recently from 60a6347 to 31dca25 Compare March 10, 2026 11:53
@frederickobrien frederickobrien added the run_chromatic Runs chromatic when label is applied label Mar 10, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Mar 10, 2026
Copy link
Contributor

@domlander domlander left a comment

Choose a reason for hiding this comment

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

It may be easier to wait until the Football Redesign AB test is complete before merging this PR as it maybe be safer to ensure not disturbing their test. The WebX team have discussed here: #15402 (comment)

The gap between the center and right columns at the left-col breakpoint is now correct and looks infinitely better!

I'm also delighted to see negative margins be removed.

${from.desktop} {
display: block;
padding-top: 6px;
grid-row: ${isMedia ? 3 : 1} / span 999;
Copy link
Contributor

Choose a reason for hiding this comment

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

The 999 looks odd but I couldn't find a better solution. There doesn't look to be one for implicit rows: w3c/csswg-drafts#2402, so I think what you have might be best. I was mistaken before: grid-row: 1 / -1 only works for non-implicit grid rows I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I haven't found a nicer way. We could calculate the number of rows based on furniture layout but I could see that becoming gnarlier than the span 999 quite quickly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I think I've cracked this with f21f751. By incorporating row spans into the furniture config we get the dual benefit of losing span 999 and (I think) making the furniture config more intuitive to use:

desktop: [
			['title', 'right-column'],
			['headline', 'right-column'],
			['standfirst', 'right-column'],
			['main-media', 'right-column'],
			['meta', 'right-column'],
			['body', 'right-column'],
		]

@frederickobrien frederickobrien force-pushed the grid-api-for-standard-layout branch from f8d04e0 to 65fb6fa Compare March 11, 2026 10:03
@frederickobrien frederickobrien force-pushed the grid-api-for-standard-layout branch from 65fb6fa to 825d214 Compare March 11, 2026 10:11
@frederickobrien frederickobrien added the run_chromatic Runs chromatic when label is applied label Mar 11, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Mar 11, 2026
@frederickobrien frederickobrien added the run_chromatic Runs chromatic when label is applied label Mar 11, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Mar 11, 2026
@frederickobrien frederickobrien force-pushed the grid-api-for-standard-layout branch from 5eb44e7 to 1752cc7 Compare March 11, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Departmental tracking: maintenance work, not a fix or a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants