Skip to content

Commit 3d1fde5

Browse files
committed
Banner Updates
1 parent 28c380c commit 3d1fde5

File tree

1 file changed

+49
-35
lines changed

1 file changed

+49
-35
lines changed

usehooks.com/src/components/CountdownBanner.astro

Lines changed: 49 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
import Button from "../components/Button.astro";
33
---
44

5-
<!-- Show this one on Day 2 of launch week -->
6-
<!-- <section class="banner week">
5+
<!-- Show this one on Day 2 of launch week --><!-- <section class="banner week">
76
<h3><img src="/img/react-gg-logo-sticker.svg" width="358" height="86" alt="react.gg" /> Launch Week Sale</h3>
87
<div class="countdown">
98
<div class="number day">
@@ -37,28 +36,36 @@ import Button from "../components/Button.astro";
3736
<ol class="footnotes">
3837
<li>Literally the cheapest this course will ever be</li>
3938
</ol>
40-
</section> -->
41-
<!-- Show this one on Day 1 of launch week -->
39+
</section> --><!-- Show this one on Day 1 of launch week -->
4240
<section class="banner day-one">
43-
<h3><img src="/img/react-gg-logo-sticker.svg" width="358" height="86" alt="react.gg" /> Launch Day Sale</h3>
41+
<h3>
42+
<img
43+
src="/img/react-gg-logo-sticker.svg"
44+
width="358"
45+
height="86"
46+
alt="react.gg"
47+
/> Launch Day Sale
48+
</h3>
4449
<div class="countdown">
50+
<div class="number day">
51+
<span id="days" class="time">--</span>
52+
<span id="days-label" class="unit">day(s)</span>
53+
</div>
4554
<div class="number hour">
46-
<span id="hours" class="time">22</span>
47-
<span class="unit">hours</span>
55+
<span id="hours" class="time">--</span>
56+
<span id="hours-label" class="unit">hour(s)</span>
4857
</div>
4958
<div class="number minute">
50-
<span id="minutes" class="time">47</span>
51-
<span class="unit">minutes</span>
59+
<span id="minutes" class="time">--</span>
60+
<span id="minutes-label" class="unit">minute(s)</span>
5261
</div>
5362
<div class="number second">
54-
<span id="seconds" class="time">12</span>
55-
<span class="unit">seconds</span>
63+
<span id="seconds" class="time">--</span>
64+
<span id="seconds-label" class="unit">second(s)</span>
5665
</div>
5766
</div>
5867
<p>
59-
Get up to <strong>25% off</strong><sup>1</sup> the react.gg course, plus a <strong
60-
>FREE</strong
61-
> ui.dev t-shirt<sup>2,3,4</sup> if you buy before this giant clock goes to zero.
68+
Get up to <strong>25% off</strong> the react.gg course, plus a <strong>FREE</strong> ui.dev t-shirt if you buy before this giant clock goes to zero.
6269
</p>
6370
<Button
6471
type="link"
@@ -67,12 +74,12 @@ import Button from "../components/Button.astro";
6774
size="large"
6875
text="Get the course + t-shirt now"
6976
/>
70-
<ol class="footnotes">
77+
<!-- <ol class="footnotes">
7178
<li>Literally the cheapest this course will ever be</li>
7279
<li>Our shirts are very soft</li>
7380
<li>We’ll probably send you stickers too</li>
7481
<li>We might lose money on this but wdgaf</li>
75-
</ol>
82+
</ol> -->
7683
</section>
7784

7885
<style>
@@ -92,7 +99,7 @@ import Button from "../components/Button.astro";
9299
display: flex;
93100
justify-content: center;
94101
align-items: center;
95-
gap: .5rem;
102+
gap: 0.5rem;
96103
background-color: var(--brand-pink);
97104
border: var(--border-dark);
98105
border-radius: 0.3rem;
@@ -219,7 +226,7 @@ import Button from "../components/Button.astro";
219226
const { days, hours, minutes, seconds, hasExpired } = timeUntilTargetPST(
220227
2023,
221228
9,
222-
12
229+
7
223230
);
224231

225232
if (hasExpired) {
@@ -233,19 +240,14 @@ import Button from "../components/Button.astro";
233240
}
234241

235242
// Uncomment when we move to the other banner
236-
// document.getElementById("days").textContent = String(days).padStart(2, "0");
237-
document.getElementById("hours").textContent = String(hours).padStart(
238-
2,
239-
"0"
240-
);
241-
document.getElementById("minutes").textContent = String(minutes).padStart(
242-
2,
243-
"0"
244-
);
245-
document.getElementById("seconds").textContent = String(seconds).padStart(
246-
2,
247-
"0"
248-
);
243+
document.getElementById("days").textContent = days.value;
244+
document.getElementById("days-label").textContent = days.label;
245+
document.getElementById("hours").textContent = hours.value;
246+
document.getElementById("hours-label").textContent = hours.label;
247+
document.getElementById("minutes").textContent = minutes.value;
248+
document.getElementById("minutes-label").textContent = minutes.label;
249+
document.getElementById("seconds").textContent = seconds.value;
250+
document.getElementById("seconds-label").textContent = seconds.label;
249251
}
250252

251253
function showCountDown() {
@@ -294,10 +296,22 @@ import Button from "../components/Button.astro";
294296
const seconds = delta % 60;
295297

296298
return {
297-
days: String(days).padStart(2, "0"),
298-
hours: String(hours).padStart(2, "0"),
299-
minutes: String(minutes).padStart(2, "0"),
300-
seconds: String(seconds).padStart(2, "0"),
299+
days: {
300+
value: String(days).padStart(2, "0"),
301+
label: days === 1 ? "day" : "days",
302+
},
303+
hours: {
304+
value: String(hours).padStart(2, "0"),
305+
label: hours === 1 ? "hour" : "hours",
306+
},
307+
minutes: {
308+
value: String(minutes).padStart(2, "0"),
309+
label: minutes === 1 ? "minute" : "minutes",
310+
},
311+
seconds: {
312+
value: String(seconds).padStart(2, "0"),
313+
label: seconds === 1 ? "second" : "seconds",
314+
},
301315
hasExpired: targetUTC < currentUTC,
302316
};
303317
}

0 commit comments

Comments
 (0)