Skip to content

Commit 275ecad

Browse files
committed
Coming soon state when lineup unavailable
1 parent 5447cba commit 275ecad

File tree

2 files changed

+47
-32
lines changed

2 files changed

+47
-32
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ export default meta;
4242

4343
type Story = StoryObj<typeof meta>;
4444

45-
export const LineupsStory = {
45+
export const WithLineup = {
4646
args: {
4747
matchStats,
4848
},
4949
} satisfies Story;
50+
51+
export const ComingSoon = {} satisfies Story;

dotcom-rendering/src/components/Lineups.tsx

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { palette } from '../palette';
1818
import Union from '../static/icons/Union.svg';
1919

2020
type Props = {
21-
matchStats: FootballMatchStats;
21+
matchStats?: FootballMatchStats;
2222
};
2323

2424
const lineupSectionId = 'lineups';
@@ -32,33 +32,41 @@ export const Lineups = ({ matchStats }: Props) => {
3232
aria-labelledby={lineupSectionId}
3333
>
3434
<Title text="Lineups" id={lineupSectionId} />
35-
<PlayerList
36-
team={matchStats.homeTeam}
37-
isSubstitute={false}
38-
isHome={true}
39-
/>
40-
<PlayerList
41-
team={matchStats.awayTeam}
42-
isSubstitute={false}
43-
isHome={false}
44-
/>
45-
</section>
46-
<section
47-
css={playerListSectionGridStyles}
48-
aria-labelledby={substitutesSectionId}
49-
>
50-
<Title text="Substitutes" id={substitutesSectionId} />
51-
<PlayerList
52-
team={matchStats.homeTeam}
53-
isSubstitute={true}
54-
isHome={true}
55-
/>
56-
<PlayerList
57-
team={matchStats.awayTeam}
58-
isSubstitute={true}
59-
isHome={false}
60-
/>
35+
{matchStats ? (
36+
<>
37+
<PlayerList
38+
team={matchStats.homeTeam}
39+
isSubstitute={false}
40+
isHome={true}
41+
/>
42+
<PlayerList
43+
team={matchStats.awayTeam}
44+
isSubstitute={false}
45+
isHome={false}
46+
/>{' '}
47+
</>
48+
) : (
49+
<span css={comingSoon}>Coming soon</span>
50+
)}
6151
</section>
52+
{matchStats && (
53+
<section
54+
css={playerListSectionGridStyles}
55+
aria-labelledby={substitutesSectionId}
56+
>
57+
<Title text="Substitutes" id={substitutesSectionId} />
58+
<PlayerList
59+
team={matchStats.homeTeam}
60+
isSubstitute={true}
61+
isHome={true}
62+
/>
63+
<PlayerList
64+
team={matchStats.awayTeam}
65+
isSubstitute={true}
66+
isHome={false}
67+
/>
68+
</section>
69+
)}
6270
</section>
6371
);
6472
};
@@ -154,9 +162,8 @@ const PlayerList = ({
154162
const sectionStyles = css`
155163
border: 1px solid ${palette('--football-match-stat-border')};
156164
border-radius: 6px;
157-
158165
padding-top: 6px;
159-
166+
color: ${palette('--football-match-stat-text')};
160167
background-color: ${palette('--football-match-info-background')};
161168
`;
162169

@@ -190,7 +197,6 @@ const shirtNumber = css`
190197
display: inline-block;
191198
width: ${space[5]}px;
192199
${textSansBold14}
193-
color: ${palette('--football-match-stat-text')};
194200
${from.desktop} {
195201
${textSansBold15}
196202
}
@@ -213,7 +219,14 @@ const playerName = css`
213219
${from.desktop} {
214220
${textSans15}
215221
}
216-
color: ${palette('--football-match-stat-text')};
222+
`;
223+
224+
const comingSoon = css`
225+
padding-top: ${space[2]}px;
226+
${textSans14}
227+
${from.desktop} {
228+
${textSans15}
229+
}
217230
`;
218231

219232
const BackgroundRed = sourcePalette.news[400];

0 commit comments

Comments
 (0)