Skip to content

Conversation

@abeddow91
Copy link
Contributor

@abeddow91 abeddow91 commented Dec 18, 2025

What does this change?

Introduces the redesigned star rating component behind a 0% opt in test.

As part of the redesign the component has been refactored.
It now features

  • a medium size of stars (along side small and large)
  • padding param of small, medium or large padding size for the rating component
  • a dark (perhaps overloaded - suggestions welcome!) theme param. This allows the star rating to support 2 colour variations. The dark theme is required when the ratings component is places on cards with variable background colour (such as feature cards) to ensure we meet AA accessibility standards.

Why?

The star rating component is used site wide. By using a 0% opt in test, we can ensure design and engineering are given ample time to QA this change, especially given we are approaching the festive period.

To allow for the opt in test, the legacy star rating component has been deprecated and a new component has been added. This should make clean up easier once the the designs are fully approved and ready to roll out site wide.

Screenshots

Before After
10before 10after
3before 3after
4before 4after
5before 5after
6before 6after
7before 7after
8before 8after
9before 9after
0before 0after
1before 1after
2before 2after

@github-actions
Copy link

github-actions bot commented Dec 18, 2025

@abeddow91 abeddow91 mentioned this pull request Dec 18, 2025
…r accessibility requirments. These are needed for cards such as feature cards which have lighter / variable backgrounds
@abeddow91 abeddow91 marked this pull request as ready for review December 18, 2025 14:36
@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.

width: (data.imageAsset ?? fallbackData.imageAsset).fields.width,
height: (data.imageAsset ?? fallbackData.imageAsset).fields.height,
} satisfies Parameters<typeof RichLink>[0]['imageData'];
console.log('rich link component', isInStarRatingVariant);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need this log?

'1',
article.config.abTests,
article.config.abTests.starRatingRedesignVariant,
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Rogue logging!

</>
);
case 'model.dotcomrendering.pageElements.RichLinkBlockElement':
console.log('render element', abTests);
Copy link
Contributor

Choose a reason for hiding this comment

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

Rogue logging!

@SiAdcock
Copy link
Contributor

Looks good @abeddow91 ❤️

Since the new Star Rating design forms part of Source core components, would it make sense to build this component into the Source React component library? This would help align the design-developer handoff for future changes and ensure the component is not tightly coupled to dotcom-rendering

rating: Rating;
size: RatingSizeType;
paddingSize?: PaddingSizeType;
/** The dark theme is to account for star ratings that appear on lighter / translucent backgrounds (eg feature cards). The dark theme ensures we meet AA accessibility standard*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this comment be split over multiple lines?

// ----- Imports ----- //
import type { Meta } from '@storybook/react-webpack5';
import { StarRating } from './StarRating';
import { StarRatingDeprecated } from './StarRatingDeprecated';
Copy link
Contributor

Choose a reason for hiding this comment

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

Can stories be added for the new StarRating component? (In addition to leaving these deprecated ones up for the time being)

size: RatingSizeType;
paddingSize?: PaddingSizeType;
/** The dark theme is to account for star ratings that appear on lighter / translucent backgrounds (eg feature cards). The dark theme ensures we meet AA accessibility standard*/
useDarkTheme?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with your comment on "dark theme" being an overloaded term. I think this can be easily confused with styles that are applied when the user is in dark mode. I think even a less descriptive word such as "secondary" or "alternative" paired with your comment would be better.

css={[starsWrapper, !isInStarRatingVariant && starWrapperColour]}
data-spacefinder-role="inline"
>
<StarRatingDeprecated rating={rating} size={size} />
Copy link
Contributor

Choose a reason for hiding this comment

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

How will this work once we remove the test? Will this component be swapped out for the new <StarRating /> component?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or will we not need it at all?

isInStarRatingVariant={
isInStarRatingVariant
}
starRating={article.starRating}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does the StarRating component now get called from within the ArticleHeadline component?

)}

{
/* TODO : Remove this star rating once the starRatingVariant testing is complete and new designs are merged (eta Jan 2026)*/
Copy link
Contributor

@domlander domlander Dec 22, 2025

Choose a reason for hiding this comment

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

Will we still be using star ratings in lightbox images once the new designs are merged?

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.

This looks great Anna, thanks for writing all this code!

There's a few comments that need to be deleted as SImon pointed out and it would be great if a few more stories could be added in places we have the new star ratings.

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.

4 participants