import React, { useState } from 'react'; import axios from 'axios'; import contactInfo from 'data/Contact/form.json'; import contactInfoRTL from 'data/Contact/form-rtl.json'; const Form = ({ style = "4", rtl }) => { const [formData, setFormdata] = useState({ name: "", email: "", phone: "", website: "", option: "", message: "" }); const contactInfoData = rtl ? contactInfoRTL : contactInfo; const handleFormChange = (e) => { setFormdata(prev => ({ ...prev, [e.target.name]: e.target.value })) } const handleFormSubmit = async (e) => { e.preventDefault(); const formValues = new FormData(); formValues.append('name', formData.name); formValues.append('email', formData.email); formValues.append('phone', formData.phone); formValues.append('website', formData.website); formValues.append('option', formData.option); formValues.append('message', formData.message); const res = await axios.post('/contact.php', formValues) .catch(err => alert(err.message)); if (!res) return; alert('Form submitted successfully.') } return (
{ style === '5' && ( <>

{ rtl ? 'يسعدنا' : 'Get In' } { rtl ? 'تواصلك' : 'Touch' } { rtl && 'معنا' }

{ rtl ? 'سنتواصل معك مرة أخرى بعد استلام طلبك خلال 24 ساعة' : 'We will contact again after receive your request in 24h' }

{ contactInfoData.phone }

{ contactInfoData.email }

{ contactInfoData.address }

) }

{ rtl ? 'الحقل اللذى يحتوى على هذة العلامة اجبارى *' : 'The field is required mark as *' }

) } export default Form