Tweak storylines component (like/dislike, section positioning and pagination)#15227
Tweak storylines component (like/dislike, section positioning and pagination)#15227Georges-GNM wants to merge 11 commits intomainfrom
Conversation
…w the text and ensuring the component and pagination get correctly displayed after the first container even if there's only one container
317f304 to
7ffb01f
Compare
23fc2e1 to
281cda4
Compare
281cda4 to
d6ad637
Compare
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
|
Would it now make sense to move the call to |
abeddow91
left a comment
There was a problem hiding this comment.
This looks really good so far. I've left a couple of comments to address some consistency and readability issues.
dotcom-rendering/src/components/StorylinesSectionContent.importable.tsx
Outdated
Show resolved
Hide resolved
dotcom-rendering/src/components/StorylinesSectionContent.importable.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Dominik Lander <dominik.lander@guardian.co.uk> Co-authored-by: Anna Beddow <anna.beddow@gmail.com>
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 |
…in the selected title, and removing the pillar colours to instead just use the main brand colour
c590455 to
53c049a
Compare
…torylinesSectionContent to palette
|
|
||
| /// LIKE/DISLIKE FEEDBACK FOOTER | ||
| const footerStyling = css` | ||
| // The storylines style variable enables left alignment in the tag page storylines section |
There was a problem hiding this comment.
The variable has been renamed so this comment can be tweaked
| ), | ||
| ]} | ||
| > | ||
| <div css={[sectionHeadlineUntilLeftCol]}> |
There was a problem hiding this comment.
| <div css={[sectionHeadlineUntilLeftCol]}> | |
| <div css={sectionHeadlineUntilLeftCol}> |
| > | ||
| <Footer | ||
| dislikeHandler={ | ||
| dislikeHandler ?? |
There was a problem hiding this comment.
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 ( | ||
| <> |
There was a problem hiding this comment.
This Fragment is no longer needed.
| ${textSans20}; | ||
| font-weight: 700; | ||
| color: ${pillarColour}; | ||
| color: ${palette('--storylines-titles')}; |
There was a problem hiding this comment.
Thanks for putting these in the palette
| padding-bottom: ${space[2]}px; | ||
| `} | ||
| > | ||
| Storylines is an experimental feature we are showing |
| * 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 = () => ( |
There was a problem hiding this comment.
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 && |
There was a problem hiding this comment.
"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?
What does this change?
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