Skip to content

Commit a9edfc5

Browse files
committed
reset the email after submit
1 parent 4258a98 commit a9edfc5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/Donation.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22
import { donationData } from '@/constants/Donation';
33
import { Link } from 'react-router-dom';
44
import { volunteerImages } from '@/constants/Volunteer';
@@ -18,6 +18,8 @@ const Donation: React.FC = () => {
1818
window.location.href = donationData.url;
1919
};
2020

21+
const [Email, setEmail] = useState('');
22+
2123
return (
2224
<section className="relative overflow-hidden bg-white text-black py-16 px-4">
2325
{/* Animated background circles */}
@@ -142,14 +144,18 @@ const Donation: React.FC = () => {
142144
<motion.form
143145
action="https://buttondown.com/api/emails/embed-subscribe/sugarlabs"
144146
method="post"
147+
onSubmit={() => setTimeout(() => setEmail(''), 500)}
145148
>
146149
<input
147150
className="px-4 py-2 border border-gray-300 rounded-l-full focus:outline-none"
148151
placeholder="Enter your email"
149152
type="email"
150153
name="email"
154+
value={Email}
155+
onChange={(e) => setEmail(e.target.value)}
151156
required
152157
/>
158+
<input value="1" type="hidden" name="embed" />
153159
<motion.button
154160
className="px-6 py-2 bg-red-500 text-white font-bold rounded-r-full shadow-lg hover:bg-red-600 transition duration-300"
155161
whileHover={{ scale: 1.05 }}

0 commit comments

Comments
 (0)