Skip to content

Commit 2bb58e9

Browse files
adding dark mode colours to product card and added a couple of new paletteDeclarations
Add width to storybook so it always shows at 280x regardless of the breakpoint
1 parent 6d6ea3f commit 2bb58e9

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { css } from '@emotion/react';
12
import type { Meta, StoryObj } from '@storybook/react-webpack5';
23
import { productImage } from '../../fixtures/manual/productImage';
34
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/articleFormat';
@@ -256,6 +257,15 @@ const meta = {
256257
},
257258
showReadMore: true,
258259
},
260+
render: (args) => (
261+
<div
262+
css={css`
263+
width: 280px;
264+
`}
265+
>
266+
<ProductCarouselCard {...args} />
267+
</div>
268+
),
259269
} satisfies Meta<typeof ProductCarouselCard>;
260270

261271
export default meta;

dotcom-rendering/src/components/ProductCarouselCard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { css } from '@emotion/react';
22
import {
33
headlineBold20,
44
headlineMedium17,
5-
lifestyle,
65
space,
76
textSans17,
87
textSansBold15,
98
textSansBold17,
109
} from '@guardian/source/foundations';
1110
import type { ArticleFormat } from '../lib/articleFormat';
11+
import { palette } from '../palette';
1212
import type { ProductBlockElement } from '../types/content';
1313
import { ProductCardButtons } from './ProductCardButtons';
1414
import { ProductCardImage } from './ProductCardImage';
@@ -26,7 +26,7 @@ const baseCard = css`
2626

2727
const productCarouselCardHeading = css`
2828
${headlineBold20};
29-
color: ${lifestyle[300]};
29+
color: ${palette('--product-card-headline')};
3030
`;
3131

3232
const brandAndProductName = css`
@@ -37,7 +37,7 @@ const readMoreCta = css`
3737
${textSansBold15};
3838
text-decoration-line: underline;
3939
text-decoration-color: #dcdcdc; /* stylelint-disable-line */
40-
color: ${lifestyle[400]};
40+
color: ${palette('--product-card-read-more')};
4141
text-underline-offset: 20%;
4242
padding-bottom: ${space[2]}px;
4343
`;

dotcom-rendering/src/paletteDeclarations.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5096,10 +5096,19 @@ const productCardBorderLight: PaletteFunction = () =>
50965096
sourcePalette.lifestyle[300];
50975097
const productCardBorderDark: PaletteFunction = () =>
50985098
sourcePalette.lifestyle[500];
5099+
const productCardHeadingTextLight: PaletteFunction = () =>
5100+
sourcePalette.lifestyle[300];
5101+
const productCardHeadingTextDark: PaletteFunction = () =>
5102+
sourcePalette.lifestyle[500];
50995103
const productCardBorderNeutralDark: PaletteFunction = () =>
51005104
sourcePalette.neutral[38];
51015105
const productCardBorderNeutralLight: PaletteFunction = () =>
51025106
sourcePalette.neutral[86];
5107+
const productCardReadMoreLight: PaletteFunction = () =>
5108+
sourcePalette.lifestyle[400];
5109+
const productCardReadMoreDark: PaletteFunction = () =>
5110+
sourcePalette.lifestyle[600];
5111+
51035112
const privacyTextRegularLight: PaletteFunction = () => sourcePalette.neutral[7];
51045113
const privacyTextDark: PaletteFunction = () => sourcePalette.neutral[86];
51055114
const witnessTitleText: PaletteFunction = ({ theme }) => {
@@ -7541,6 +7550,14 @@ const paletteColours = {
75417550
light: productCardBorderNeutralLight,
75427551
dark: productCardBorderNeutralDark,
75437552
},
7553+
'--product-card-headline': {
7554+
light: productCardHeadingTextLight,
7555+
dark: productCardHeadingTextDark,
7556+
},
7557+
'--product-card-read-more': {
7558+
light: productCardReadMoreLight,
7559+
dark: productCardReadMoreDark,
7560+
},
75447561
'--pullquote-background': {
75457562
light: pullQuoteBackgroundLight,
75467563
dark: pullQuoteBackgroundDark,

0 commit comments

Comments
 (0)