Skip to content

Conversation

@oliverabrahams
Copy link
Contributor

@oliverabrahams oliverabrahams commented Aug 27, 2025

co-authored by @charleycampbell
co-authored by @emma-imber

What does this change?

We are adding a new Product Element to be displayed on filter articles. https://github.com/guardian/flexible-model/discussions/81
Screenshot 2025-10-28 at 09 29 59

We're introducing two new product card components, InlineProductCard and LeftColProductCard, along with supporting changes to styling, image handling, and schema updates.

These components are designed to display product information inline and in the left column of articles, with different layouts and palette colours. The changes also include updates to the image sizing logic for product cards and enhancements to the button styling for product links.

New Product Card Components:

  • Added InlineProductCard and LeftColProductCard components to display product information, including brand, product name, image, pricing, retailer links, CTAs, and statistics. Each component has its own layout and styling for different breakpoints.

Styling and Palette Enhancements:

  • Added new palette variables for product card backgrounds and product button backgrounds, including hover states, to ensure consistent theming.

Image Handling:

  • Extended the Picture component to support a new productCard role type, with tailored image sizing logic for product cards at different breakpoints.

Schema Updates:

  • Added new Product Block Element to the schema Add product element frontend#28208
  • Updated article and block schemas to require and validate an elementId for LinkBlockElement, ensuring unique identification and improved data integrity for product-related links. This was already coming from FE but was missing from the model in DCR. This is a fix and allows us to directly copy elements from FE for ProductElement.stories.tsx

Why?

We are adding in a new element called Product. This product element will help structure the product data and also the ability to display product reviews as part of the new designs. This is the RFC

Screenshots -

LeftCol product card (only on Wide)
Screenshot 2025-10-28 at 10 58 27

Screenshot 2025-10-28 at 10 58 36

Inline product card (from Left Col)

Screenshot 2025-10-28 at 10 58 10 Screenshot 2025-10-28 at 10 58 47

@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Sep 9, 2025
@github-actions
Copy link

github-actions bot commented Sep 9, 2025

@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Sep 9, 2025
@github-actions
Copy link

github-actions bot commented Sep 9, 2025

@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Oct 24, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Oct 24, 2025
@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Oct 27, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Oct 27, 2025
@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Oct 27, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Oct 27, 2025
@oliverabrahams oliverabrahams marked this pull request as ready for review October 28, 2025 11:01
@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 this to the The Filter milestone Oct 28, 2025
@oliverabrahams oliverabrahams added the run_chromatic Runs chromatic when label is applied label Oct 28, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Oct 28, 2025
@JamieB-gu JamieB-gu requested a review from a team October 28, 2025 16:27
@arelra
Copy link
Member

arelra commented Oct 28, 2025

Could we squash the commits into a smaller number of self contained and explanatory commits please?
It helps us review, keeps the history tidy and aids the investigation process for incident resolution.

isCardOnly: false,
};

export const Default = () => <InlineProductCard {...sampleProductCard} />;
Copy link
Contributor

Choose a reason for hiding this comment

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

We're updating existing stories to Component Story Format 3 and any new stories should use this format. You'll find a lot of examples in the codebase such as Pill.stories.tsx. It's a bit more concise and removes some of the boilerplate as in a lot of cases you can use the default render function and not have to explicitly render the component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦 I remember this from last time...

gap: ${space[1]}px;
${textSans20};

${until.mobileLandscape} {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd make textSans17 the default and swap this to from so it's consistent with the other media queries. (ie. the mobile styles are the defaults)

label={productCta.label}
url={productCta.url}
priority={index === 0 ? 'primary' : 'tertiary'}
cssOverrides={
Copy link
Contributor

@jamesmockett jamesmockett Oct 28, 2025

Choose a reason for hiding this comment

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

Given ProductLinkButton is a new component specifically added for Filter articles, does it need to support cssOverrides as it's a bit of an anti-pattern? Could this be achieved by adding props to apply these styles instead? (eg. fullWidth or similar)


const primaryHeading = css`
${headlineMedium24};
${until.mobileLandscape} {
Copy link
Contributor Author

@oliverabrahams oliverabrahams Oct 29, 2025

Choose a reason for hiding this comment

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

should change this also -> mobile first then ${from.``}

@oliverabrahams
Copy link
Contributor Author

oliverabrahams commented Oct 30, 2025

Could we squash the commits into a smaller number of self contained and explanatory commits please? It helps us review, keeps the history tidy and aids the investigation process for incident resolution.

We have begun spliting this into a couple of smaller PRs

#14771
#14772
#14773
#14774

@oliverabrahams
Copy link
Contributor Author

closed because we are spliting this into smaller PRs

#14771
#14772
#14773
#14774

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.

6 participants