Skip to content

Commit 669773f

Browse files
authored
Match lineup coming soon state (#15280)
* Coming soon state when lineup unavailable * Move lineup available logic from match info page
1 parent 05d4f8a commit 669773f

File tree

3 files changed

+58
-35
lines changed

3 files changed

+58
-35
lines changed

dotcom-rendering/src/components/FootballMatchInfo.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ function teamHasStats({
3939
export const FootballMatchInfo = ({ matchStats, table }: Props) => {
4040
const showStats =
4141
teamHasStats(matchStats.homeTeam) && teamHasStats(matchStats.awayTeam);
42-
const showLineups =
43-
matchStats.homeTeam.players.length > 0 &&
44-
matchStats.awayTeam.players.length > 0;
4542
return (
4643
<section aria-label={'match-info'} css={layoutCss}>
4744
{showStats && (
@@ -106,7 +103,7 @@ export const FootballMatchInfo = ({ matchStats, table }: Props) => {
106103
/>
107104
</>
108105
)}
109-
{showLineups && <Lineups matchStats={matchStats} />}
106+
<Lineups matchStats={matchStats} />
110107
{table && <LeagueTable table={table} />}
111108
</section>
112109
);

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,17 @@ 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 = {
52+
args: {
53+
matchStats: {
54+
homeTeam: { ...matchStats.homeTeam, players: [] },
55+
awayTeam: { ...matchStats.awayTeam, players: [] },
56+
},
57+
},
58+
} satisfies Story;

dotcom-rendering/src/components/Lineups.tsx

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,40 +25,52 @@ const lineupSectionId = 'lineups';
2525
const substitutesSectionId = 'substitutes';
2626

2727
export const Lineups = ({ matchStats }: Props) => {
28+
const lineupAvailable =
29+
matchStats.homeTeam.players.length > 0 &&
30+
matchStats.awayTeam.players.length > 0;
31+
2832
return (
2933
<section css={sectionStyles} aria-label="Team Lineups and Substitutes">
3034
<section
3135
css={playerListSectionGridStyles}
3236
aria-labelledby={lineupSectionId}
3337
>
3438
<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-
/>
39+
{lineupAvailable ? (
40+
<>
41+
<PlayerList
42+
team={matchStats.homeTeam}
43+
isSubstitute={false}
44+
isHome={true}
45+
/>
46+
<PlayerList
47+
team={matchStats.awayTeam}
48+
isSubstitute={false}
49+
isHome={false}
50+
/>{' '}
51+
</>
52+
) : (
53+
<span css={comingSoon}>Coming soon</span>
54+
)}
6155
</section>
56+
{lineupAvailable && (
57+
<section
58+
css={playerListSectionGridStyles}
59+
aria-labelledby={substitutesSectionId}
60+
>
61+
<Title text="Substitutes" id={substitutesSectionId} />
62+
<PlayerList
63+
team={matchStats.homeTeam}
64+
isSubstitute={true}
65+
isHome={true}
66+
/>
67+
<PlayerList
68+
team={matchStats.awayTeam}
69+
isSubstitute={true}
70+
isHome={false}
71+
/>
72+
</section>
73+
)}
6274
</section>
6375
);
6476
};
@@ -154,9 +166,8 @@ const PlayerList = ({
154166
const sectionStyles = css`
155167
border: 1px solid ${palette('--football-match-stat-border')};
156168
border-radius: 6px;
157-
158169
padding-top: 6px;
159-
170+
color: ${palette('--football-match-stat-text')};
160171
background-color: ${palette('--football-match-info-background')};
161172
`;
162173

@@ -190,7 +201,6 @@ const shirtNumber = css`
190201
display: inline-block;
191202
width: ${space[5]}px;
192203
${textSansBold14}
193-
color: ${palette('--football-match-stat-text')};
194204
${from.desktop} {
195205
${textSansBold15}
196206
}
@@ -213,7 +223,14 @@ const playerName = css`
213223
${from.desktop} {
214224
${textSans15}
215225
}
216-
color: ${palette('--football-match-stat-text')};
226+
`;
227+
228+
const comingSoon = css`
229+
padding-top: ${space[2]}px;
230+
${textSans14}
231+
${from.desktop} {
232+
${textSans15}
233+
}
217234
`;
218235

219236
const BackgroundRed = sourcePalette.news[400];

0 commit comments

Comments
 (0)