Skip to content

Commit 0ba2cdc

Browse files
committed
Prefer alternative over dark when referring to the second theme for star ratings.
This is to prevent overloading the term dark which is more commonly used in the code base to refer to dark mode
1 parent 42309f8 commit 0ba2cdc

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

dotcom-rendering/src/components/FeatureCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ export const FeatureCard = ({
645645
<StarRating
646646
rating={starRating}
647647
size={starRatingSize}
648-
useDarkTheme={true}
648+
useAltTheme={true}
649649
/>
650650
) : (
651651
<div css={starRatingWrapper}>

dotcom-rendering/src/components/StarRating/StarRating.stories.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Meta, StoryObj } from '@storybook/react-webpack5';
2-
32
import { type Props, StarRating } from './StarRating';
43

54
const meta = {
@@ -61,9 +60,9 @@ export const StarsWithLargePadding: Story = {
6160
},
6261
};
6362

64-
export const StarsWithDarkTheme: Story = {
63+
export const StarsWithAlternativeTheme: Story = {
6564
args: {
6665
size: 'large',
67-
useDarkTheme: true,
66+
useAltTheme: true,
6867
},
6968
};

dotcom-rendering/src/components/StarRating/StarRating.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ const emptyStarColor = css`
2323
background-color: ${palette('--star-rating-empty-background')};
2424
`;
2525

26-
const emptyStarDarkColor = css`
27-
background-color: ${palette('--star-rating-empty-dark-background')};
26+
const emptyStarAltColor = css`
27+
background-color: ${palette('--star-rating-empty-alt-background')};
2828
`;
2929

3030
const determineSize = (size: RatingSizeType) => {
@@ -108,15 +108,15 @@ export type Props = {
108108
rating: Rating;
109109
size: RatingSizeType;
110110
paddingSize?: PaddingSizeType;
111-
/** 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*/
112-
useDarkTheme?: boolean;
111+
/** The alternative theme is to account for star ratings that appear on lighter / translucent backgrounds (e.g. feature cards). The alternative theme ensures we meet AA accessibility standards */
112+
useAltTheme?: boolean;
113113
};
114114

115115
export const StarRating = ({
116116
rating,
117117
size,
118118
paddingSize = 'small',
119-
useDarkTheme = false,
119+
useAltTheme = false,
120120
}: Props) => (
121121
<div
122122
css={[determineSize(size), determinePaddingTop(paddingSize), container]}
@@ -131,7 +131,7 @@ export const StarRating = ({
131131
key={i}
132132
css={[
133133
starBackground,
134-
useDarkTheme ? emptyStarDarkColor : emptyStarColor,
134+
useAltTheme ? emptyStarAltColor : emptyStarColor,
135135
]}
136136
>
137137
<SvgStarOutline />

dotcom-rendering/src/paletteDeclarations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7967,7 +7967,7 @@ const paletteColours = {
79677967
light: starRatingEmptyBackgroundColourLight,
79687968
dark: starRatingEmptyBackgroundColourDark,
79697969
},
7970-
'--star-rating-empty-dark-background': {
7970+
'--star-rating-empty-alt-background': {
79717971
light: starRatingEmptyBackgroundColourDark,
79727972
dark: starRatingEmptyBackgroundColourDark,
79737973
},

0 commit comments

Comments
 (0)