diff --git a/src/assets/css/style.css b/src/assets/css/style.css index 6025ce5..bab1b11 100644 --- a/src/assets/css/style.css +++ b/src/assets/css/style.css @@ -3521,6 +3521,28 @@ header.fix_style.white_header { margin-bottom: 20px; } +/* For the err msg */ +.contact_page_section .contact_inner .contact_form form .form-group span{ + font-size: 12px; + color: tomato; + padding: 3px; + display: none; +} + +.contact_page_section .contact_inner .contact_form form .form-group input:invalid ~ span{ + display: block; +} + +/* +input:invalid[focused="true"]{ + border: 1px solid red; +} + +input:invalid[focused="true"] ~ span{ + display: block; +} +*/ + .contact_page_section .contact_inner .contact_form diff --git a/src/component/Contact/Main.js b/src/component/Contact/Main.js index 7b65228..1ea58d3 100644 --- a/src/component/Contact/Main.js +++ b/src/component/Contact/Main.js @@ -7,18 +7,72 @@ import BGImg2 from "../../assets/images/bread_crumb_bg_two.png"; import SiteService from "../../vendors/service/siteService"; -const Main = ({ brdcum }) => { - let [countries, setCountries] = useState([]) // initial state for country dropdown - let countryClass = new SiteService() // instantiating the class +// Form Inputs +const FormInput = (props) => { + let { + name, + type, + placeholder, + required, + maxLenght, + errorMessage, + value, + onChange, + } = props; + return ( +
+ + {errorMessage} +
+ ); +}; + +const Main = ({ brdcum }) => { + // Form Validation + const [values, setValues] = useState({ + name: "", + email: "", + phone: "", + msg: "", + country: '' + }); //initial state values + const [countries, setCountries] = useState([]); // initial state for country dropdown + + // Gave a generic name for multiple calls + const API_CALL = new SiteService(); // instantiating the class + const allCountry = () => { - return countryClass.countryData(); - } + return API_CALL.countryData(); + }; + + const contactForm = () => { + return API_CALL.contactData(); + }; + + // Submitting form + const handleSubmit = (e) => { + e.preventDefault(); + }; + + const onChange = (e) => { + setValues({ ...values, [e.target.name]: e.target.value }); + }; //CALLS THE API AFTER COMPONENT LOADS - useEffect(()=>{ - allCountry().then((data)=> setCountries(Object.values(data.data))) - },[]) + useEffect(() => { + allCountry().then((data) => setCountries(Object.values(data.data))); + console.log(values); + }, []); return ( <> @@ -77,44 +131,64 @@ const Main = ({ brdcum }) => {

- Leave a message + Leave a message

Fill up form below, our team will get back soon

-
-
- -
-
- -
+ + {/* Contact Form */} + + + +
-
- -
+ +
@@ -130,6 +204,8 @@ const Main = ({ brdcum }) => {
+ + {/* Contact Info */}
image @@ -153,7 +229,9 @@ const Main = ({ brdcum }) => {
Email Us - example@gmail.com + + {process.env.REACT_APP_SUPPORT_EMAIL} +
  • @@ -162,7 +240,9 @@ const Main = ({ brdcum }) => {
  • Call Us - +1 (888) 553-46-11 + + {process.env.REACT_APP_US_PHONE} +
  • @@ -171,7 +251,7 @@ const Main = ({ brdcum }) => {
    Visit Us -

    5687, Business Avenue, New York, USA 5687

    +

    {process.env.REACT_APP_US_ADDRESS}

  • @@ -186,4 +266,4 @@ const Main = ({ brdcum }) => { ); }; -export default Main; +export default Main; \ No newline at end of file diff --git a/src/vendors/service/siteService.js b/src/vendors/service/siteService.js index dbea9f4..5a17884 100644 --- a/src/vendors/service/siteService.js +++ b/src/vendors/service/siteService.js @@ -5,14 +5,21 @@ class SiteService { constructor() { console.log("Er are here anyway"); } + // Blog Data {Get} blogData() { return this.getAuxEnd("blogdata", null); } + // Country Data {GET} countryData() { return this.getAuxEnd("/country", null); } + // Contact Data{POST} + contactData() { + return this.postAuxEnd("/contact", null) + } + faqData() {} //---------------------------------------- -----