Skip to content

Conversation

@oliverabrahams
Copy link
Contributor

@oliverabrahams oliverabrahams commented Dec 4, 2025

What does this change?

  • Extends the functionality of the ScrollableCarousel to incorporate requirements of Product Carousel
  • Adds the Product Carousel

Changes to ScrollableCarousel

  • Showing cards of a defined width at different breakpoints by defining a default width for the cards as well as width from different breakpoints by adding
    • type FixedSlideWidth = { defaultWidth: number; widthFromBreakpoints: { breakpoint: Breakpoint; width: number }[];}
    • This has been achieved with a discriminated union type with two kinds
type Props =
	| {
kind: CarouselKind.VisibleSlides;
...
visibleCarouselSlidesOnMobile: number;
visibleCarouselSlidesOnTablet: number;
} | {
kind: CarouselKind.FixedWidthSlides;
....
fixedSlideWidth: FixedSlideWidth;
}
  • Choosing if to add padding or not. On the fronts padding is needed but for our article designs we do not.

    • isArticle: boolean
  • Adds support for subgrid alignment within the cards by adding a new ScrollableCarousel.SubgridItem

Why?

Screenshots

Screenshot 2025-12-11 at 15 33 15

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

@oliverabrahams oliverabrahams changed the base branch from main to filter/carousel-card December 4, 2025 16:27
@oliverabrahams oliverabrahams changed the base branch from filter/carousel-card to main December 4, 2025 16:27
@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Dec 4, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Dec 4, 2025
@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Dec 4, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Dec 4, 2025
@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Dec 10, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Dec 10, 2025
@github-actions
Copy link

github-actions bot commented Dec 10, 2025

@oliverabrahams oliverabrahams marked this pull request as ready for review December 17, 2025 10:24
@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.

@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Dec 17, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Dec 17, 2025
@oliverabrahams oliverabrahams changed the title Draft - Add product carousel Add product carousel Dec 17, 2025
@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Dec 17, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Dec 17, 2025
@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Dec 17, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Dec 17, 2025
@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Dec 17, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Dec 17, 2025
@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Dec 17, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Dec 17, 2025
@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Dec 17, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Dec 17, 2025
Copy link
Contributor

@charleycampbell charleycampbell left a comment

Choose a reason for hiding this comment

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

Looks good to me just one clarification question! I like the refactoring of the scrollable carousel - have we tested the carousels on the Fronts to check they haven't changed/broken?

@oliverabrahams oliverabrahams requested review from a team and JamieB-gu and removed request for JamieB-gu December 18, 2025 10:28
@oliverabrahams
Copy link
Contributor Author

oliverabrahams commented Dec 18, 2025

Looks good to me just one clarification question! I like the refactoring of the scrollable carousel - have we tested the carousels on the Fronts to check they haven't changed/broken?

I have not tested this, I will put it on code before merging. I was assuming that because there are no changes in chromatic it is probably fine but will test in CODE also

@arelra
Copy link
Member

arelra commented Dec 19, 2025

Could we squash the commits where possible please. It would be great if each commit describes an atomic change and hence makes the history easier to read.

… subgrid, and link to the product text heading using the H2. The product element heading h2Id is added using the enhancers in dcr
…f the card using Visable slides on either mobile or tablet. Remove the css in the carousel that is front specific and put that behind the !isArticle boolean
…l carousel. There will be a future PR for carousels with 2 cards + stories
@oliverabrahams oliverabrahams force-pushed the mob/scrollable-products branch from f20853d to a064393 Compare December 19, 2025 17:09
@oliverabrahams oliverabrahams added this to the The Filter milestone Jan 5, 2026
kind={CarouselKind.FixedWidthSlides}
carouselLength={products.length}
fixedSlideWidth={fixedCardWidth}
gapSizes={{ row: 'none', column: 'large' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess none is a useful option to have, although it's maybe not required here as shouldStackCards is not set so the carousel will always be on a single row meaning you don't need to worry about the row gap.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea this is also helpful for when we don't want this set. Here where we are using a subgrid we then don't have to override it.

*/
const containerStyles = css`
position: relative;
const frontContainerStyles = css`
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably outside the scope of this PR, but I wonder if it would make sense to create a separate fronts carousel component that imports the base carousel and applies the necessary fronts specific styles? (Moving them from here.) That would, hopefully, leave a simpler generic carousel that could be more easily reused elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See comment below - Interested what you both think

* A component used in the carousel fronts containers (e.g. small/medium/feature)
*/
export const ScrollableCarousel = ({
kind,
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than passing this as a prop, have you considered exposing separate Carousel components that wrap a base carousel? This keeps the base carousel relatively clean and simple, while extracting and isolating the fancier logic and styles into the kinds of carousels that need them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea I did consider doing this, it was quite hard to work out what a base was for some things. For the fronts carousel there is a 32px peeping card but for our designs we have just a fixed width of cards at different breakpoints, the API for one doesn't really work for the other. There isn't an obvious base between these two, you could override one with the other by choosing one as the base but that seems worse than having 2 kinds IMO. This maybe because we don't have a generic one in the DS. Happy to chat about it though if you disagree.

Copy link
Contributor

@SiAdcock SiAdcock Jan 9, 2026

Choose a reason for hiding this comment

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

Yeah, my question came from a position of ignorance, I don't know how easy it would be to achieve. My thinking was actually to define a generic carousel (the elusive "DS carousel" you mention), and then use this as the base for a fronts-specific carousel and a product-specific carousel. It would be easier to do this now that we have two different carousel designs to work from and identify what carousel features we feel ought to be generic

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants