Skip to content

Commit

Permalink
success popup
Browse files Browse the repository at this point in the history
  • Loading branch information
devsisingh committed May 18, 2024
1 parent fe21938 commit 00c6856
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/app/nodeform/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const Page = () => {
const [twitter, settwitter] = useState("");
const [wallet, setwallet] = useState("");

const [showPopup, setShowPopup] = useState(false);

// Handler functions for checkbox click events
const handleYesChange = () => {
setChecked("yes");
Expand Down Expand Up @@ -60,6 +62,26 @@ const Page = () => {
const result = await response.json();
console.log("Form submitted successfully:", result);
// You can add any success message or redirection here

// Reset form fields
setname('');
setemail('');
settelegram('');
setprojectname('');
setprojecturl('');
setregion('');
settwitter('');
setChecked(null);
setwallet('');

// Show success popup
setShowPopup(true);

// Hide success popup after 3 seconds
setTimeout(() => {
setShowPopup(false);
}, 3000);

} catch (error) {
console.error("Error submitting form:", error);
// You can add error handling here
Expand Down Expand Up @@ -208,6 +230,16 @@ const Page = () => {
</form>
</div>
</section>

{showPopup && (
<div className="fixed inset-0 flex items-center justify-center bg-gray-900 bg-opacity-50 text-black">
<div className="bg-white p-8 rounded-xl shadow-lg text-center">
<h2 className="text-2xl font-bold mb-4">Success!</h2>
<p>Your form has been submitted successfully.</p>
</div>
</div>
)}

</div>
);
};
Expand Down

0 comments on commit 00c6856

Please sign in to comment.