From 8584337c2fa186c2572ec61e713343fc7f94c86e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 May 2024 18:29:32 +0530 Subject: [PATCH] added form validation to contact us form. --- src/components/ContactUs.jsx | 163 ++++++++++++++++++----------------- 1 file changed, 85 insertions(+), 78 deletions(-) diff --git a/src/components/ContactUs.jsx b/src/components/ContactUs.jsx index 024efca..3f8adfa 100644 --- a/src/components/ContactUs.jsx +++ b/src/components/ContactUs.jsx @@ -1,78 +1,85 @@ -// components/ContactUs.jsx -import React, {useState} from 'react'; -import aboutImage from '../assets/cartoon.png'; -import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; -import {faEnvelope, faFemale, faMobilePhone} from "@fortawesome/free-solid-svg-icons"; - - -const ContactUs = () => { - - const [email, setEmail] = useState("") - const [message, setMessage] = useState("") - const [name, setName] = useState("") - - const handleSubmit = (e) => { - e.preventDefault() - if(!name.trim() || !message.trim() || !email.trim()){ - alert("Fill all the fields") - } - alert("Message sent successfully") - } - - - return ( - -
-
-
-
-
- Modern building architecture -
-
-
Follow us
- -
-
-
Email
-
info@timewarp.com
-
-
-
Phone
-
+1 (555) 123-4567
-
-
- -
-
-
-
-

Contact Us

-
Contact us for a quote
-
-
Get a quote
-
- { - setName(e.target.value) - }} className="rounded-xl h-10 w-72 p-3 " placeholder="Name: eg- Elon Mask"/> - { - setEmail(e.target.value) - }} className="rounded-xl h-10 w-72 p-3" placeholder="Email: eg- Elon@gmail.com"/> - -