Skip to content

Commit 985cf1c

Browse files
committed
Simplified live grid layout for stories
1 parent 455e69c commit 985cf1c

File tree

2 files changed

+49
-12
lines changed

2 files changed

+49
-12
lines changed

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

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,49 @@
11
import { css } from '@emotion/react';
2-
import { palette, space } from '@guardian/source/foundations';
2+
import { breakpoints, from, palette } from '@guardian/source/foundations';
33
import type { Meta, StoryObj } from '@storybook/react-webpack5';
44
import { FootballMiniMatchStats } from './FootballMiniMatchStats';
55

6+
const gridCss = css`
7+
background-color: ${palette.neutral[97]};
8+
/**
9+
* Extremely simplified live blog grid layout as we're only interested in
10+
* the 240px wide left column added at the desktop breakpoint.
11+
* dotcom-rendering/src/layouts/LiveLayout.tsx
12+
*/
13+
${from.desktop} {
14+
display: grid;
15+
grid-column-gap: 20px;
16+
grid-template-columns: 240px 1fr;
17+
}
18+
`;
19+
20+
const containerCss = css`
21+
padding: 10px;
22+
${from.desktop} {
23+
padding-left: 20px;
24+
padding-right: 0;
25+
}
26+
`;
27+
628
const meta = {
729
title: 'Components/Football Mini Match Stats',
830
component: FootballMiniMatchStats,
931
decorators: [
1032
(Story) => (
11-
<div
12-
css={css`
13-
padding: ${space[4]}px;
14-
background-color: ${palette.neutral[97]};
15-
`}
16-
>
17-
<Story />
33+
<div css={gridCss}>
34+
<div css={containerCss}>
35+
<Story />
36+
</div>
1837
</div>
1938
),
2039
],
2140
parameters: {
22-
viewport: {
23-
defaultViewport: 'mobileMedium',
41+
chromatic: {
42+
viewports: [
43+
breakpoints.mobileMedium,
44+
breakpoints.tablet,
45+
breakpoints.wide,
46+
],
2447
},
2548
},
2649
} satisfies Meta<typeof FootballMiniMatchStats>;

dotcom-rendering/src/components/FootballMiniMatchStats.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { css } from '@emotion/react';
2-
import { palette } from '@guardian/source/foundations';
2+
import { from, palette } from '@guardian/source/foundations';
33
import {
44
LinkButton,
55
SvgArrowRightStraight,
@@ -12,6 +12,19 @@ const containerCss = css`
1212
gap: 10px;
1313
`;
1414

15+
const buttonTextCss = css`
16+
${from.desktop} {
17+
display: none;
18+
}
19+
`;
20+
21+
const buttonTextShortCss = css`
22+
display: none;
23+
${from.desktop} {
24+
display: inline;
25+
}
26+
`;
27+
1528
type FootballTeam = {
1629
name: string;
1730
colour: string;
@@ -62,7 +75,8 @@ export const FootballMiniMatchStats = ({
6275
iconSide="right"
6376
theme={{ backgroundPrimary: palette.sport[400] }}
6477
>
65-
More stats, line-ups and tables
78+
<span css={buttonTextCss}>More stats, line-ups and tables</span>
79+
<span css={buttonTextShortCss}>Stats and line ups</span>
6680
</LinkButton>
6781
</div>
6882
);

0 commit comments

Comments
 (0)