Skip to content

Commit 1512383

Browse files
committed
Replace hardcoded values with props
1 parent 87c23d8 commit 1512383

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,13 @@ export const FootballMatchGoalAttempts = {
2222
name: 'Arsenal',
2323
colour: '#023474',
2424
},
25+
homeValues: {
26+
offTarget: 6,
27+
onTarget: 5,
28+
},
29+
awayValues: {
30+
offTarget: 6,
31+
onTarget: 2,
32+
},
2533
},
2634
} satisfies Story;

dotcom-rendering/src/components/FootballMatchStat.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,23 @@ const attemptCountCss = css`
240240
}
241241
`;
242242

243+
type GoalAttempt = {
244+
offTarget: number;
245+
onTarget: number;
246+
};
247+
243248
type GoalAttemptProps = {
244249
homeTeam: Team;
245250
awayTeam: Team;
251+
homeValues: GoalAttempt;
252+
awayValues: GoalAttempt;
246253
};
247254

248255
export const FootballMatchGoalAttempts = ({
249256
homeTeam,
250257
awayTeam,
258+
homeValues,
259+
awayValues,
251260
}: GoalAttemptProps) => {
252261
return (
253262
<div css={[containerCss, desktopPaddingCss, goalAttemptsLayoutCss]}>
@@ -263,10 +272,10 @@ export const FootballMatchGoalAttempts = ({
263272
}}
264273
>
265274
Off target
266-
<span css={attemptCountCss}>6</span>
275+
<span css={attemptCountCss}>{homeValues.offTarget}</span>
267276
<div css={onTargetCss}>
268277
On target
269-
<span css={attemptCountCss}>5</span>
278+
<span css={attemptCountCss}>{homeValues.onTarget}</span>
270279
</div>
271280
</div>
272281
<div
@@ -280,10 +289,10 @@ export const FootballMatchGoalAttempts = ({
280289
}}
281290
>
282291
Off target
283-
<span css={attemptCountCss}>6</span>
292+
<span css={attemptCountCss}>{awayValues.offTarget}</span>
284293
<div css={[onTargetCss, onTargetAwayCss]}>
285294
On target
286-
<span css={attemptCountCss}>2</span>
295+
<span css={attemptCountCss}>{awayValues.onTarget}</span>
287296
</div>
288297
</div>
289298
</div>

0 commit comments

Comments
 (0)