|
|
|
@ -9,6 +9,7 @@ import Location from "../../components/Location"; |
|
|
|
|
import { connect } from "react-redux"; |
|
|
|
|
import scroll from "../../util/scroll"; |
|
|
|
|
import { publicApi } from "../../redux/actions"; |
|
|
|
|
import _ from "lodash"; |
|
|
|
|
|
|
|
|
|
interface FormData { |
|
|
|
|
name?: string; |
|
|
|
@ -17,7 +18,13 @@ interface FormData { |
|
|
|
|
text?: string; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function Contact({ departmans, selectedDepartman, contactData, getContactData }: any) { |
|
|
|
|
function Contact({ |
|
|
|
|
departmans, |
|
|
|
|
selectedDepartman, |
|
|
|
|
contactData, |
|
|
|
|
getContactData, |
|
|
|
|
theme, |
|
|
|
|
}: any) { |
|
|
|
|
const [formData, setFormData] = useState<FormData | undefined>(undefined); |
|
|
|
|
const [unit, setUnit] = useState("info"); |
|
|
|
|
const onChange = (e: any) => { |
|
|
|
@ -28,9 +35,17 @@ function Contact({ departmans, selectedDepartman, contactData, getContactData }: |
|
|
|
|
scroll.goToTop(); |
|
|
|
|
getContactData(); |
|
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
const light = theme === "light"; |
|
|
|
|
return ( |
|
|
|
|
<div className="contact main d-flex flex-column"> |
|
|
|
|
<div |
|
|
|
|
className={_.join( |
|
|
|
|
[ |
|
|
|
|
"contact main d-flex flex-column", |
|
|
|
|
light ? "contact-light bg-white" : "contact-dark bg-black", |
|
|
|
|
], |
|
|
|
|
" " |
|
|
|
|
)} |
|
|
|
|
> |
|
|
|
|
<Navbar /> |
|
|
|
|
<main className="d-flex flex-column"> |
|
|
|
|
<header> |
|
|
|
@ -38,7 +53,9 @@ function Contact({ departmans, selectedDepartman, contactData, getContactData }: |
|
|
|
|
</header> |
|
|
|
|
<div className="mobile flex-column"> |
|
|
|
|
<div className="d-flex contact__tab"> |
|
|
|
|
<figure className={unit !== "info" ? "contact__tab--figureactive" : ""}></figure> |
|
|
|
|
<figure |
|
|
|
|
className={unit !== "info" ? "contact__tab--figureactive" : ""} |
|
|
|
|
></figure> |
|
|
|
|
<button |
|
|
|
|
className={unit === "info" ? "contact__tab--active" : ""} |
|
|
|
|
onClick={() => setUnit("info")} |
|
|
|
@ -101,7 +118,10 @@ function Contact({ departmans, selectedDepartman, contactData, getContactData }: |
|
|
|
|
label={"انتخاب دپارتمان"} |
|
|
|
|
selectedOptions={selectedDepartman} |
|
|
|
|
/> |
|
|
|
|
<Textarea placeholder="متن پیام را اینجا تایپ کنید" /> |
|
|
|
|
<Textarea |
|
|
|
|
theme={theme} |
|
|
|
|
placeholder="متن پیام را اینجا تایپ کنید" |
|
|
|
|
/> |
|
|
|
|
<div className="d-flex justify-content-end py-4"> |
|
|
|
|
<button className="submit submit-large">ارسال پیام</button> |
|
|
|
|
</div> |
|
|
|
@ -137,7 +157,7 @@ function Contact({ departmans, selectedDepartman, contactData, getContactData }: |
|
|
|
|
label={"انتخاب دپارتمان"} |
|
|
|
|
selectedOptions={selectedDepartman} |
|
|
|
|
/> |
|
|
|
|
<Textarea placeholder="متن پیام را اینجا تایپ کنید" /> |
|
|
|
|
<Textarea theme={theme} placeholder="متن پیام را اینجا تایپ کنید" /> |
|
|
|
|
<div className="d-flex justify-content-end py-4"> |
|
|
|
|
<button className="submit submit-large">ارسال پیام</button> |
|
|
|
|
</div> |
|
|
|
@ -169,8 +189,12 @@ function Contact({ departmans, selectedDepartman, contactData, getContactData }: |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export default connect((state: any) => ({ |
|
|
|
|
export default connect( |
|
|
|
|
(state: any) => ({ |
|
|
|
|
departmans: state.publicApi.departmans, |
|
|
|
|
selectedDepartman: state.publicApi.selectedDepartman, |
|
|
|
|
contactData: state.publicApi.contactData, |
|
|
|
|
}), {getContactData : publicApi.getContactData})(Contact); |
|
|
|
|
theme: state.publicApi.theme, |
|
|
|
|
}), |
|
|
|
|
{ getContactData: publicApi.getContactData } |
|
|
|
|
)(Contact); |
|
|
|
|