Skip to content

Commit e40fcc9

Browse files
committed
Inform user to check the inbox
1 parent cba8f9c commit e40fcc9

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/components/social/SocialSubscribe.astro

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const socialLinks = [
99
];
1010
---
1111

12-
<!-- Same background and structure as your other bluebox sections -->
1312
<div class="w-full bg-[#d4d5e5] flex flex-col items-center justify-center py-20 px-4 text-center relative z-10">
1413
<h1 class="text-4xl md:text-6xl font-bold mb-10 leading-tight text-[#17223A]">
1514
Follow us<br />for updates
@@ -53,10 +52,18 @@ const socialLinks = [
5352
</button>
5453
</form>
5554

55+
<p
56+
id="subscribeMessage"
57+
class="hidden mt-4 text-green-600 text-lg font-medium transition-opacity duration-500 opacity-0"
58+
>
59+
Please check your email to confirm. 📬
60+
</p>
5661
</div>
5762

5863
<script>
5964
const form = document.getElementById("subscribeForm");
65+
const message = document.getElementById("subscribeMessage");
66+
6067
form?.addEventListener("submit", handleSubscribe);
6168

6269
async function handleSubscribe(event: SubmitEvent) {
@@ -78,8 +85,16 @@ const socialLinks = [
7885
const r = await result.text();
7986
if (r === "Created.") {
8087
input.value = "";
88+
89+
message?.classList.remove("hidden");
90+
setTimeout(() => message?.classList.add("opacity-100"), 50);
91+
92+
setTimeout(() => {
93+
message?.classList.remove("opacity-100");
94+
setTimeout(() => message?.classList.add("hidden"), 500);
95+
}, 5000);
8196
}
82-
} catch (e) {
97+
} catch {
8398
}
8499
}
85100
</script>

0 commit comments

Comments
 (0)