Skip to content

Commit 9385918

Browse files
committed
Add subscribe for updates section
1 parent fe58c5c commit 9385918

File tree

8 files changed

+133
-3
lines changed

8 files changed

+133
-3
lines changed

public/icons/bluesky.svg

Lines changed: 4 additions & 0 deletions
Loading

public/icons/instagram.svg

Lines changed: 7 additions & 0 deletions
Loading

public/icons/linkedin.svg

Lines changed: 16 additions & 0 deletions
Loading

public/icons/mastodon.svg

Lines changed: 2 additions & 0 deletions
Loading

public/icons/x.svg

Lines changed: 1 addition & 0 deletions
Loading

public/icons/youtube.svg

Lines changed: 6 additions & 0 deletions
Loading
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
const socialLinks = [
3+
{ href: "https://x.com/europython", icon: "x" },
4+
{ href: "https://instagram.com/europython/", icon: "instagram" },
5+
{ href: "https://youtube.com/channel/UC98CzaYuFNAA_gOINFB0e4Q", icon: "youtube" },
6+
{ href: "https://fosstodon.org/@europython", icon: "mastodon" },
7+
{ href: "https://bsky.app/profile/europython.eu", icon: "bluesky" },
8+
{ href: "https://linkedin.com/company/europython/", icon: "linkedin" },
9+
];
10+
---
11+
12+
<!-- Same background and structure as your other bluebox sections -->
13+
<div class="w-full bg-[#d4d5e5] flex flex-col items-center justify-center py-20 px-4 text-center relative z-10">
14+
<h1 class="text-4xl md:text-6xl font-bold mb-10 leading-tight text-[#17223A]">
15+
Follow us<br />for updates
16+
</h1>
17+
18+
<div class="flex justify-center flex-wrap gap-6 mb-8">
19+
{socialLinks.map(({ href, icon }) => (
20+
<a
21+
href={href}
22+
target="_blank"
23+
rel="noopener noreferrer"
24+
class="w-16 h-16 flex items-center justify-center border-2 border-yellow-400 rounded-full hover:scale-110 transition-transform"
25+
>
26+
<img src={`/icons/${icon}.svg`} alt={icon} class="w-6 h-6" />
27+
</a>
28+
))}
29+
</div>
30+
31+
<p class="text-[#151f38] mb-8 text-sm md:text-base">
32+
Subscribe to our conference newsletter and get<br />
33+
the latest updates and special deals
34+
</p>
35+
36+
<form
37+
onsubmit="handleSubscribe(event)"
38+
class="flex flex-col sm:flex-row justify-center items-center gap-4"
39+
>
40+
<input
41+
id="emailInput"
42+
type="email"
43+
name="email"
44+
placeholder="Your email"
45+
required
46+
class="px-4 py-3 rounded-[10px] bg-white text-black text-base font-medium w-72 text-center"
47+
/>
48+
<button
49+
type="submit"
50+
class="font-bold text-lg px-4 py-4 bg-button rounded-[10px] inline-block leading-4 hover:bg-button-hover not-prose outline-solid outline bg-transparent text-xl text-secondary outline-secondary text-black"
51+
>
52+
Subscribe
53+
</button>
54+
</form>
55+
56+
</div>
57+
58+
<script>
59+
async function handleSubscribe(event) {
60+
event.preventDefault();
61+
62+
const input = document.getElementById("emailInput");
63+
if (!(input instanceof HTMLInputElement)) return;
64+
65+
const email = input.value.trim();
66+
if (!email) return alert("Please enter a valid email");
67+
68+
try {
69+
const result = await fetch(
70+
"https://blog.europython.eu/members/api/send-magic-link/",
71+
{
72+
method: "POST",
73+
headers: { "Content-Type": "application/json" },
74+
body: JSON.stringify({ email, emailType: "subscribe" })
75+
}
76+
);
77+
78+
const r = await result.text();
79+
if (r !== "Created.") {
80+
alert("Something went wrong");
81+
} else {
82+
alert("Check your inbox!");
83+
input.value = "";
84+
}
85+
} catch (e) {
86+
console.error(e);
87+
alert("Network error");
88+
}
89+
}
90+
</script>
91+

src/pages/index.astro

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import DeadlineCard from "../components/deadline-card.astro";
1010
import { getCollection } from "astro:content";
1111
import Accent from "../components/accent/accent.astro";
1212
import Prague from "../components/hero-section/prague.astro";
13+
import SocialSubscribe from '../components/social/SocialSubscribe.astro';
1314
1415
import * as intro from "../data/home/intro.md";
1516
import * as venue from "../data/home/prague.mdx";
@@ -32,8 +33,10 @@ deadlines = deadlines
3233
{deadlines.map((deadline) => <DeadlineCard id={deadline.slug} />)}
3334
</CardContainer>
3435

35-
<div class="mt-40 px-6 pb-40 overflow-visible">
36-
<Prague title={venue.frontmatter.title}>
37-
<venue.Content />
36+
<Fullbleed>
37+
<div class="mt-32 w-full bg-[#d4d5e5] flex flex-col items-center justify-center py-08 px-4 text-center">
38+
<SocialSubscribe />
3839
</div>
40+
</Fullbleed>
41+
3942
</Layout>

0 commit comments

Comments
 (0)