Skip to content

Tweak storylines component (like/dislike, section positioning and pagination)#15227

Open
Georges-GNM wants to merge 11 commits intomainfrom
gl/tweak-storylines
Open

Tweak storylines component (like/dislike, section positioning and pagination)#15227
Georges-GNM wants to merge 11 commits intomainfrom
gl/tweak-storylines

Conversation

@Georges-GNM
Copy link
Contributor

@Georges-GNM Georges-GNM commented Jan 27, 2026

What does this change?

  • Sets the correct background colour for the storylines tabs section (same background as the rest of the container)
  • Moves the like/dislike footer up to the under the storyline section title (remains at the bottom on mobile under the article range text)
  • Adds the beta label as an SVG and tweaks the text on the side
  • Tightens some of the spacing around the selected storyline title text
  • Changes the selected storyline colour and category titles to main brand colour (Guardian blue) rather than pillar colours

Mainly, this PR adjusts the positioning on tag pages which only show a single container. Previously, in that case, the Storylines component was inserted at the top of the page; it now consistently appears in the second position.

This required some additional work to ensure pagination displays correctly. This is normally rendered as part of the last regular container via the FrontSection component, but this would cause the pagination to appear above the Storylines section, which isn’t ideal. We now check whether the Storylines component is present. If so, FrontSection is passed an undefined pagination prop and pagination is instead rendered within the Storylines component.

Screenshots

Before After
before after
before2 after2

…w the text and ensuring the component and pagination get correctly displayed after the first container even if there's only one container
@Georges-GNM Georges-GNM added the maintenance Departmental tracking: maintenance work, not a fix or a feature label Jan 28, 2026
@github-actions
Copy link

github-actions bot commented Jan 28, 2026

@Georges-GNM Georges-GNM self-assigned this Jan 28, 2026
@Georges-GNM Georges-GNM added the run_chromatic Runs chromatic when label is applied label Jan 28, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Jan 28, 2026
@Georges-GNM Georges-GNM added the run_chromatic Runs chromatic when label is applied label Jan 28, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Jan 28, 2026
@Georges-GNM Georges-GNM marked this pull request as ready for review January 28, 2026 11:31
@github-actions
Copy link

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.

@github-actions
Copy link

github-actions bot commented Jan 28, 2026

@Georges-GNM Georges-GNM added the run_chromatic Runs chromatic when label is applied label Jan 28, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Jan 28, 2026
@domlander
Copy link
Contributor

Would it now make sense to move the call to FrontPagination into TagPageLayout, so that you'd no longer need to call FrontPagination from FrontSection and StorylinesSection? It might help simplify the code a bit and make more sense from a composition of components standpoint. I don't think any other caller of FrontSection uses the pagination prop. I wonder how this would affect Treats. Do you know any tag pages where treats are used?

Copy link
Contributor

@abeddow91 abeddow91 left a comment

Choose a reason for hiding this comment

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

This looks really good so far. I've left a couple of comments to address some consistency and readability issues.

Co-authored-by: Dominik Lander <dominik.lander@guardian.co.uk>
Co-authored-by: Anna Beddow <anna.beddow@gmail.com>
@Georges-GNM
Copy link
Contributor Author

Georges-GNM commented Jan 29, 2026

Would it now make sense to move the call to FrontPagination into TagPageLayout, so that you'd no longer need to call FrontPagination from FrontSection and StorylinesSection? It might help simplify the code a bit and make more sense from a composition of components standpoint. I don't think any other caller of FrontSection uses the pagination prop. I wonder how this would affect Treats. Do you know any tag pages where treats are used?

Yeah, that is a good idea - at some point I was getting the DRY bug, but also wanted to avoid refactoring existing logic as much as possible.

I can't think of any tag pages where treats might be used - from my limited knowledge, treats can only appear on curated containers, so probably safe to do this.

Edit: So I did try this, but lifting the pagination component to TagPageLayout meant adding css logic to the layout, which to my eye brought up small spacing issues which made me nervous enough about the change to prefer avoiding that approach. Could be a worthwhile refactor for the future though!

…in the selected title, and removing the pillar colours to instead just use the main brand colour
@Georges-GNM Georges-GNM added the run_chromatic Runs chromatic when label is applied label Feb 18, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Feb 18, 2026
@Georges-GNM Georges-GNM added the run_chromatic Runs chromatic when label is applied label Feb 18, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Feb 18, 2026

/// LIKE/DISLIKE FEEDBACK FOOTER
const footerStyling = css`
// The storylines style variable enables left alignment in the tag page storylines section
Copy link
Contributor

Choose a reason for hiding this comment

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

The variable has been renamed so this comment can be tweaked

),
]}
>
<div css={[sectionHeadlineUntilLeftCol]}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<div css={[sectionHeadlineUntilLeftCol]}>
<div css={sectionHeadlineUntilLeftCol}>

>
<Footer
dislikeHandler={
dislikeHandler ??
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these handlers passed in as props? The component is only called in one place (StorylinesSectionContent.importable.tsx Line 200) and doesn't use these props. So the handlers will always be undefined. In fact, the following props all don't appear to be used: containerName, containerLevel, description, pageId, showDateHeader, toggleable, hasNavigationButtons, dislikeHandler, likeHandler.

}

return (
<>
Copy link
Contributor

Choose a reason for hiding this comment

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

This Fragment is no longer needed.

${textSans20};
font-weight: 700;
color: ${pillarColour};
color: ${palette('--storylines-titles')};
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for putting these in the palette

padding-bottom: ${space[2]}px;
`}
>
Storylines is an experimental feature we are showing
Copy link
Contributor

Choose a reason for hiding this comment

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

MUCH better

* At the moment this is just used for the AI storylines section on tag pages.
* If commonly reused in the future, might benefit from being uploaded to guim.co.uk or moved to source.
*/
export const SvgBetaLabel = () => (
Copy link
Contributor

Choose a reason for hiding this comment

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

I recently learned that you can give an SVG a title to make them more accessible. Try it with a screen reader (CMD + F5 on a mac) to test. I found that a screen reader would only announce "image" for an SVG without a title.

aspectRatio={'5:4'}
/>
</FrontSection>
{insertStorylinesSection &&
Copy link
Contributor

Choose a reason for hiding this comment

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

"Mainly, this PR adjusts the positioning on tag pages which only show a single container. Previously, in that case, the Storylines component was inserted at the top of the page; it now consistently appears in the second position."

I may be wrong, but if there are multiple containers on the page, will this show the Storylines component below the first container, and is this expected?

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.

3 participants

Comments