From 99bd6683deb53a627c2cd2c26583c07f8e906722 Mon Sep 17 00:00:00 2001 From: SHAFAY HASEEB <32669422+shafay07@users.noreply.github.com> Date: Tue, 13 Oct 2020 01:49:14 +0300 Subject: [PATCH 1/4] main page translated into arabic --- .../app/src/components/BlockSection/index.js | 34 +++--- .../app/src/components/ContactForm/index.js | 108 +++++++++--------- frontend/app/src/components/Footer/index.js | 76 ++++++------ .../app/src/components/HeaderSection/index.js | 28 ++--- .../src/components/NewsLetterForm/index.js | 80 ++++++------- .../app/src/pages/Connected/Home/index.js | 40 +++++-- .../app/src/pages/Connected/Home/texts.json | 20 ++-- 7 files changed, 205 insertions(+), 181 deletions(-) diff --git a/frontend/app/src/components/BlockSection/index.js b/frontend/app/src/components/BlockSection/index.js index daad342f..27a0f21b 100644 --- a/frontend/app/src/components/BlockSection/index.js +++ b/frontend/app/src/components/BlockSection/index.js @@ -1,9 +1,9 @@ -import React, { PureComponent } from "react"; -import "./style.scss"; -import { connect } from "react-redux"; +import React, { PureComponent } from "react" +import "./style.scss" +import { connect } from "react-redux" -import Markdown from "../Markdown"; -import { content as selectContent } from "../../redux/staticcontent/selectors"; +import Markdown from "../Markdown" +import { content as selectContent } from "../../redux/staticcontent/selectors" class BlockSection extends PureComponent { render() { @@ -12,17 +12,16 @@ class BlockSection extends PureComponent { subtitle, children, extra, + partner_extra, halfpage, inverted, className, - } = this.props; + } = this.props return (

{title}

@@ -30,23 +29,24 @@ class BlockSection extends PureComponent { className="BlockSection--left__subtitle" source={subtitle} /> + {partner_extra} {extra}
{children}
- ); + ) } } const mapStateToProps = (state, ownProps) => { - const { titleKey, subtitleKey } = ownProps; + const { titleKey, subtitleKey } = ownProps - const content = selectContent(state); + const content = selectContent(state) return { title: content[titleKey] || ownProps.title, subtitle: content[subtitleKey] || ownProps.subtitle, - }; -}; + } +} -export default connect(mapStateToProps)(BlockSection); +export default connect(mapStateToProps)(BlockSection) diff --git a/frontend/app/src/components/ContactForm/index.js b/frontend/app/src/components/ContactForm/index.js index cb26e9b0..29ca1690 100644 --- a/frontend/app/src/components/ContactForm/index.js +++ b/frontend/app/src/components/ContactForm/index.js @@ -1,103 +1,103 @@ -import React, { useState } from "react"; -import "./style.scss"; - -import Form from "../inputs/Form"; -import TextInput from "../inputs/TextInput"; -import TextArea from "../inputs/TextArea"; -import FormRow from "../inputs/FormRow"; -import SubmitButton from "../inputs/SubmitButton"; -import BlockSection from "../BlockSection"; -import { useFormField } from "../../hooks/formhooks"; -import { isEmail } from "../../utils/regex"; -import { minDelay } from "../../utils/misc"; -import KEYS from "../../redux/staticcontent/keys"; - -import ContactRequestService from "../../services/contactrequests"; +import React, { useState } from "react" +import "./style.scss" + +import Form from "../inputs/Form" +import TextInput from "../inputs/TextInput" +import TextArea from "../inputs/TextArea" +import FormRow from "../inputs/FormRow" +import SubmitButton from "../inputs/SubmitButton" +import BlockSection from "../BlockSection" +import { useFormField } from "../../hooks/formhooks" +import { isEmail } from "../../utils/regex" +import { minDelay } from "../../utils/misc" +import KEYS from "../../redux/staticcontent/keys" + +import ContactRequestService from "../../services/contactrequests" const ContactForm = () => { const fields = { firstName: { ...useFormField("", (value) => { if (!value || value.length === 0) { - return "This field is required"; + return "This field is required" } if (value.length > 100) { - return "That's a pretty long name... Something shorter, please."; + return "That's a pretty long name... Something shorter, please." } - return null; + return null }), }, lastName: { ...useFormField("", (value) => { if (!value || value.length === 0) { - return "This field is required"; + return "This field is required" } if (value.length > 100) { - return "That's a pretty long name... Something shorter, please."; + return "That's a pretty long name... Something shorter, please." } - return null; + return null }), }, email: { ...useFormField("", (value) => { if (!isEmail(value)) { - return "This is not a valid email"; + return "This is not a valid email" } - return null; + return null }), }, company: { ...useFormField("", (value) => { if (!value || value.length === 0) { - return "This field is required"; + return "This field is required" } if (value.length > 100) { - return "That's a pretty long company name... Something shorter, please."; + return "That's a pretty long company name... Something shorter, please." } }), }, message: { ...useFormField("", (value) => { if (!value || value.length === 0) { - return "Please enter a message :)"; + return "Please enter a message :)" } if (value.length > 500) { - return "Message can be at most 500 characters"; + return "Message can be at most 500 characters" } - return null; + return null }), }, - }; + } - const [formLoading, setFormLoading] = useState(false); - const [formError, setFormError] = useState(false); - const [formSuccess, setFormSuccess] = useState(false); + const [formLoading, setFormLoading] = useState(false) + const [formError, setFormError] = useState(false) + const [formSuccess, setFormSuccess] = useState(false) async function handleFormSuccess(data) { - setFormLoading(true); + setFormLoading(true) minDelay(ContactRequestService.create(data), 1000) .then((res) => { - setFormSuccess(true); - setFormLoading(false); + setFormSuccess(true) + setFormLoading(false) }) .catch((e) => { - console.log("Form error", e); - setFormError(true); - setFormLoading(false); - }); + console.log("Form error", e) + setFormError(true) + setFormLoading(false) + }) } function handleFormError(errors) { - console.log("ERROR", errors); + console.log("ERROR", errors) } return ( @@ -118,42 +118,42 @@ const ContactForm = () => {