Skip to content

Commit 207a3df

Browse files
committed
small tweaks
1 parent cc8cf6b commit 207a3df

3 files changed

Lines changed: 23 additions & 47 deletions

File tree

dotcom-rendering/src/components/CricketMatchStat.tsx

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,6 @@ const numericCellStyles = css`
8787
text-align: left;
8888
`;
8989

90-
const fixedColStyles = css`
91-
flex-shrink: 0;
92-
`;
93-
94-
const batColWidthStyles = css`
95-
${fixedColStyles}
96-
width: 42px;
97-
`;
98-
9990
const howOutStyles = css`
10091
color: ${palette('--football-match-info-team-number')};
10192
`;
@@ -106,37 +97,19 @@ export const CricketMatchStatNotOutBatters = ({
10697
notOutBatters: Batter[];
10798
}) => {
10899
const currentBatters = notOutBatters.filter(
109-
(batter) => !batter.out && (batter.onStrike || batter.nonStrike),
100+
(batter) => batter.onStrike || batter.nonStrike,
110101
);
111102
return (
112103
<div css={[containerCss, desktopPaddingCss]}>
113-
<span
114-
css={css`
115-
${visuallyHidden}
116-
`}
117-
>
118-
Not Out Batters
119-
</span>
104+
<span css={visuallyHiddenStyles}>Current Batters</span>
120105
<table css={tableStyles}>
121106
<thead>
122107
<tr>
123108
<th css={tableHeadCellStyles}>Batter</th>
124-
<th
125-
css={[
126-
tableHeadCellStyles,
127-
numericCellStyles,
128-
batColWidthStyles,
129-
]}
130-
>
109+
<th css={[tableHeadCellStyles, numericCellStyles]}>
131110
Runs
132111
</th>
133-
<th
134-
css={[
135-
tableHeadCellStyles,
136-
numericCellStyles,
137-
batColWidthStyles,
138-
]}
139-
>
112+
<th css={[tableHeadCellStyles, numericCellStyles]}>
140113
Balls
141114
</th>
142115
</tr>
@@ -158,22 +131,10 @@ export const CricketMatchStatNotOutBatters = ({
158131
</div>
159132
</div>
160133
</th>
161-
<td
162-
css={[
163-
tableCellStyles,
164-
numericCellStyles,
165-
batColWidthStyles,
166-
]}
167-
>
134+
<td css={[tableCellStyles, numericCellStyles]}>
168135
{batter.runs}
169136
</td>
170-
<td
171-
css={[
172-
tableCellStyles,
173-
numericCellStyles,
174-
batColWidthStyles,
175-
]}
176-
>
137+
<td css={[tableCellStyles, numericCellStyles]}>
177138
{batter.ballsFaced}
178139
</td>
179140
</tr>

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const meta = preview.meta({
4141
});
4242

4343
const feMatchStatsSummaryData: FECricketMatchStatsSummary = {
44-
status: 'In Play',
44+
status: 'abandoned',
4545
currentBattingTeam: 'England',
4646
notOutBatters: [
4747
{
@@ -68,6 +68,18 @@ const feMatchStatsSummaryData: FECricketMatchStatsSummary = {
6868
onStrike: true,
6969
nonStrike: false,
7070
},
71+
{
72+
name: 'Devon Conway',
73+
order: 2,
74+
ballsFaced: 224,
75+
runs: 157,
76+
fours: 22,
77+
sixes: 3,
78+
out: false,
79+
howOut: 'not out',
80+
onStrike: false,
81+
nonStrike: false,
82+
},
7183
],
7284
};
7385

dotcom-rendering/src/components/CricketMiniMatchStats.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,15 @@ export const CricketMiniMatchStats = (props: Props) => {
105105
);
106106
};
107107

108+
const isMatchOver = (matchStatus: string | undefined) =>
109+
matchStatus === 'result' || matchStatus === 'abandoned';
110+
108111
const swrOptions = (
109112
refreshInterval: number,
110113
): SWRConfiguration<CricketMatchStatsSummary> => ({
111114
errorRetryCount: 1,
112115
refreshInterval: (latestData: CricketMatchStatsSummary | undefined) =>
113-
latestData?.status === 'FT' ? 0 : refreshInterval,
116+
isMatchOver(latestData?.status) ? 0 : refreshInterval,
114117
});
115118

116119
const fetcher =

0 commit comments

Comments
 (0)