diff --git a/src/Components/Pages/Contact/ContactForm.tsx b/src/Components/Pages/Contact/ContactForm.tsx index bd80ad6..4f77c28 100644 --- a/src/Components/Pages/Contact/ContactForm.tsx +++ b/src/Components/Pages/Contact/ContactForm.tsx @@ -3,8 +3,11 @@ import emailjs from "@emailjs/browser"; import { ToastContainer, toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; import { useTranslation } from "react-i18next"; -import PhoneInput, { formatPhoneNumber, parsePhoneNumber } from "react-phone-number-input"; -import 'react-phone-number-input/style.css' +import PhoneInput, { + formatPhoneNumber, + parsePhoneNumber, +} from "react-phone-number-input"; +import "react-phone-number-input/style.css"; import "./ContactForm.css"; const ContactForm = () => { @@ -22,7 +25,7 @@ const ContactForm = () => { const emptyForm = () => { toast.warning(t("contact.toasts.empty")); }; - + const invalidCountryCode = () => { toast.error(t("contact.toasts.invalidCountryCode")); }; @@ -36,7 +39,8 @@ const ContactForm = () => { (input as HTMLInputElement).value.trim() === "" ); - if (isEmpty || !phone) { // Check if phone is also empty + if (isEmpty || !phone) { + // Check if phone is also empty emptyForm(); return; } @@ -52,7 +56,10 @@ const ContactForm = () => { // Append phone number to the form const phoneInput = document.createElement("input"); phoneInput.setAttribute("type", "hidden"); - phoneInput.setAttribute("value", `+${countryCode} ${formatPhoneNumber(phone)}`); + phoneInput.setAttribute( + "value", + `+${countryCode} ${formatPhoneNumber(phone)}` + ); phoneInput.setAttribute("name", "user_phone"); e.currentTarget.appendChild(phoneInput); @@ -100,13 +107,13 @@ const ContactForm = () => { placeholder={t("contact.form.company")} />