Skip to content

Commit 3dd8f88

Browse files
committed
better images for transitions
1 parent 4a6f793 commit 3dd8f88

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

lessons/06-transitions/C-making-it-work-without-transitions.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,27 @@ Let's first make this "wrong" first - the problem where the UI locks up during t
2020
Let's make a Score.jsx file
2121

2222
```javascript
23-
export default function Score({ isPending, home, away, game }) {
23+
const loadingUrl = "/images/loading.webp";
24+
export default function Score({
25+
isPending,
26+
home,
27+
away,
28+
awayName,
29+
homeName,
30+
awayImage,
31+
homeImage,
32+
}) {
2433
return (
2534
<div className="score">
2635
<div>
27-
<h2>HOME {game}</h2>
36+
<h2>{isPending ? "HOME" : homeName}</h2>
2837
<h3>{isPending ? "" : home}</h3>
38+
<img src={isPending ? loadingUrl : homeImage} alt="home team logo" />
2939
</div>
3040
<div>
31-
<h2>AWAY {game}</h2>
41+
<h2>{isPending ? "AWAY" : awayName}</h2>
3242
<h3>{isPending ? "" : away}</h3>
43+
<img src={isPending ? loadingUrl : awayImage} alt="away team logo" />
3344
</div>
3445
</div>
3546
);
@@ -88,6 +99,8 @@ export default function App() {
8899
<option value={3}>Game 3</option>
89100
<option value={4}>Game 4</option>
90101
<option value={5}>Game 5</option>
102+
<option value={6}>Game 6</option>
103+
<option value={7}>Game 7</option>
91104
</select>
92105
<div className={`loading-container ${isPending ? "loading" : ""}`}>
93106
{" "}
@@ -96,7 +109,10 @@ export default function App() {
96109
<div>
97110
<Score
98111
isPending={isPending}
99-
game={game}
112+
homeImage={score.homeImage}
113+
homeName={score.homeName}
114+
awayImage={score.awayImage}
115+
awayName={score.awayName}
100116
home={score.home}
101117
away={score.away}
102118
/>

0 commit comments

Comments
 (0)