From 0b5dab5b2df6452db8f45fe993a5f340ed8b99a0 Mon Sep 17 00:00:00 2001 From: Bvp Karthikeya <143770362+BVPKARTHIKEYA@users.noreply.github.com> Date: Thu, 10 Oct 2024 01:30:59 +0530 Subject: [PATCH] ContactForm.jsx --- .../Contact-section/ContactForm.jsx | 114 ++++++------------ 1 file changed, 38 insertions(+), 76 deletions(-) diff --git a/src/components/Contact-section/ContactForm.jsx b/src/components/Contact-section/ContactForm.jsx index 5c9499d..690ebfb 100644 --- a/src/components/Contact-section/ContactForm.jsx +++ b/src/components/Contact-section/ContactForm.jsx @@ -1,19 +1,15 @@ import { useState } from "react"; import "./Contact-section.css"; // Ensure this path is correct -import FirstNameIcon from "../../assets/icons/first-name-icon.png"; // Correct import path -import LastNameIcon from "../../assets/icons/last-name-icon.png"; // Correct import path -import EmailIcon from "../../assets/icons/email-icon.png"; // Correct import path -import MessageIcon from "../../assets/icons/message-icon.png"; // Correct import path -import Github from "../../assets/Social-Icons/Github.png"; // Correct import path -import Insta from "../../assets/Social-Icons/instagram.png"; // Correct import path -import Twitter from "../../assets/Social-Icons/Twitter.png"; // Correct import path +import FirstNameIcon from "../../assets/icons/first-name-icon.png"; // Replace with your actual path +import EmailIcon from "../../assets/icons/email-icon.png"; // Replace with your actual path +import Github from "../../assets/Social-Icons/Github.png"; +import Insta from "../../assets/Social-Icons/instagram.png"; +import Twitter from "../../assets/Social-Icons/Twitter.png"; const ContactForm = () => { const [contactForm, setContactForm] = useState({ firstName: "", - lastName: "", email: "", - message: "", }); const [contactErrors, setContactErrors] = useState({}); @@ -25,22 +21,15 @@ const ContactForm = () => { const handleSubmit = (e) => { e.preventDefault(); const validationContactErrors = {}; - if (!contactForm.firstName.trim()) { validationContactErrors.firstName = "First name is required"; } - if (!contactForm.lastName.trim()) { - validationContactErrors.lastName = "Last name is required"; - } if (!contactForm.email.trim()) { validationContactErrors.email = "Email is required"; } if (!/\S+@\S+\.\S+/.test(contactForm.email)) { validationContactErrors.email = "Email is not valid"; } - if (!contactForm.message.trim()) { - validationContactErrors.message = "Message is required"; - } setContactErrors(validationContactErrors); @@ -48,46 +37,33 @@ const ContactForm = () => { alert("Message sent successfully"); setContactForm({ firstName: "", - lastName: "", email: "", - message: "", }); } }; return ( -
-
-
-
-
- First Name Icon - - - {contactErrors.firstName} - + <> +
+ {/* Left hand side of the form */} + {/* Right hand side of the form */} +
+ +
+
+ First Name Icon + + + {contactErrors.firstName} + +
-
- Last Name Icon - - - {contactErrors.lastName} - -
-
-
Email Icon { {contactErrors.email}
-
-
- Message Icon -