From 2c8e7b7d2ea0c1f04b61f9ba57ae720f48f9205f Mon Sep 17 00:00:00 2001 From: Ingrid Fuentes <49660565+IngridFuentes@users.noreply.github.com> Date: Thu, 15 Feb 2024 20:00:07 -0500 Subject: [PATCH] Mentor Form confirmation (#550) * mentor form-EmojiRain small changes * mentor form confirmation * mentor form confirmation * bg "light" added * bg light --- src/components/EmojiRain/index.tsx | 30 ++++++++++++++-------------- src/components/forms/mentor-form.tsx | 20 ++++++++++++++++++- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/components/EmojiRain/index.tsx b/src/components/EmojiRain/index.tsx index 2ed522a72..07dc8e03e 100644 --- a/src/components/EmojiRain/index.tsx +++ b/src/components/EmojiRain/index.tsx @@ -8,21 +8,21 @@ const EmojiRain = () => { })); return ( -
- {emojis.map((emojiObj) => ( -
- {emojiObj.emoji} -
- ))} -
+
+ {emojis.map((emojiObj) => ( +
+ {emojiObj.emoji} +
+ ))} +
); }; diff --git a/src/components/forms/mentor-form.tsx b/src/components/forms/mentor-form.tsx index cb0e3d729..b011a0825 100644 --- a/src/components/forms/mentor-form.tsx +++ b/src/components/forms/mentor-form.tsx @@ -1,9 +1,11 @@ +import EmojiRain from "@components/EmojiRain"; import { useState } from "react"; import { useForm, SubmitHandler } from "react-hook-form"; import axios from "axios"; import Input from "@ui/form-elements/input"; import Button from "@ui/button"; import { hasKey } from "@utils/methods"; +import Feedback from "@ui/form-elements/feedback"; interface IFormValues { name: string; @@ -17,6 +19,8 @@ interface IFormValues { const MentorForm = () => { const [message, setMessage] = useState(""); + const [showEmojiRain, setShowEmojiRain] = useState(false); + const { register, handleSubmit, @@ -28,6 +32,10 @@ const MentorForm = () => { try { await axios.post("/api/mentor", data); setMessage("Thank you for your registration!"); + setShowEmojiRain(true); + + setTimeout(() => setShowEmojiRain(false), 5000); + reset(); } catch (error) { setMessage("Failed to submit the form. Please try again later."); @@ -37,7 +45,6 @@ const MentorForm = () => { return (

Register

- {message &&

{message}

}
);