Skip to content

Commit

Permalink
Integrate contat form
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-kl1 committed Feb 3, 2025
1 parent c8571ee commit 2237370
Show file tree
Hide file tree
Showing 7 changed files with 217 additions and 55 deletions.
10 changes: 9 additions & 1 deletion public/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,13 @@
"pushContent": "Réservez votre place dès maintenant et rejoignez-nous pour un événement riche en échanges, en apprentissages et en opportunités !",
"days": "Jours",
"hours": "Heures",
"minutes": "Minutes"
"minutes": "Minutes",
"name": "Nom",
"fullname": "Prénom et nom de famille",
"email": "Email",
"objet": "Objet",
"message": "Message",
"help": "Comment pouvons-nous vous aider ?",
"agreeTerms": "J’accepte les Termes et conditions.",
"send": "Envoyer"
}
4 changes: 3 additions & 1 deletion public/locales/fr/faq.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"title": "FAQ & Contact",
"faq": "FAQ",
"description": "Vous avez des questions sur l'événement ? Consultez notre FAQ pour obtenir des réponses rapides sur le lieu, la billetterie, les conférences et bien plus. Si vous avez besoin de plus d'informations, n'hésitez pas à nous contacter !"
"description": "Vous avez des questions sur l'événement ? Consultez notre FAQ pour obtenir des réponses rapides sur le lieu, la billetterie, les conférences et bien plus. Si vous avez besoin de plus d'informations, n'hésitez pas à nous contacter !",
"contactFormTitle": "Toujours besoin d’aide ? Envoyer nous un message",
"contactFormActionUrl": "https://forms.zohopublic.eu/mm25fropen1/form/ContactUs/formperma/ZHVFtNjDA2zl9Kg7YZsWC2_X8jKowgy3vt6j_YvOsRQ/htmlRecords/submit"
}
66 changes: 13 additions & 53 deletions src/app/contact/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Container from "@/layouts/Container";
import { useTranslation } from "react-i18next";
import Push from "@/layouts/Push/Push";
import Faq from "@/components/Faq/Faq";
import ContactForm from "@/layouts/Form/ContactForm";

export default function Page() {
const { t } = useTranslation(['faq']);
Expand All @@ -31,7 +32,7 @@ export default function Page() {
</ContentMedia>
<div className="bg-white rounded-xl p-4 md:p-8">
<Typography
variant="h2"
variant="h4"
color="dark"
weight="semibold"
underlineColor="primary-100"
Expand All @@ -40,58 +41,17 @@ export default function Page() {
{t('faq:faq')}
</Typography>
<Faq display="grid" />
<hr/>
<div className="hidden">
<form
action='https://forms.zohopublic.eu/mm25fropen1/form/ContactUs/formperma/ZHVFtNjDA2zl9Kg7YZsWC2_X8jKowgy3vt6j_YvOsRQ/htmlRecords/submit'
name='form' id='form' method='POST' accept-charset='UTF-8' encType='multipart/form-data'>
<input type="hidden" name="zf_referrer_name" value=""/><!-- To Track referrals , place the referrer name within the " " in the above hidden input field -->
<input type="hidden" name="zf_redirect_url" value=""/><!-- To redirect to a specific page after record submission , place the respective url within the " " in the above hidden input field -->
<input type="hidden" name="zc_gad" value=""/><!-- If GCLID is enabled in Zoho CRM Integration, click details of AdWords Ads will be pushed to Zoho CRM -->
<h2>Contact Us</h2>
<p></p>
<!--Name-->
<label> Nom </label>
<input type="text" maxLength="255" name="Name_First" fieldType="7" placeholder="" />
<label>Pr&eacute;nom</label>
<input type="text" maxLength="255" name="Name_Last" fieldType="7" placeholder="" />
<label>Nom de famille</label>
<!--Email-->
<label> Email
<em>*</em>
</label>
<input type="text" maxLength="255" name="Email" value="" fieldType="9" placeholder="" />
<!--Single Line-->
<label>
Objet
<em>*</em>
</label>
<input type="text" name="SingleLine" value="" fieldType="1" maxlength="255" placeholder="" />
<!--Multi Line-->
<label> Message
<em>*</em>
</label>
<textarea name="MultiLine" maxLength="65535" placeholder=""></textarea>
<!--Terms and Conditions-->
<label>
Conditions g&eacute;n&eacute;rales
<em>*</em>
</label>
<div className="termsContainer">
<div>
<div>En cliquant sur “Soumettre”, j’autorise Meet Magento France à traiter mes données et à me
recontacter pour répondre à ma demande selon notre <a
href="https://meet-magento.opengento.fr/mentions-legales#data-protection" target="_blank"
rel="noopener noreferrer">politique de confidentialité</a>. <br/></div>
</div>
<div>
<input className="checkBoxType flLeft" name="TermsConditions" type="checkbox"/>
<label>J’accepte les Termes et conditions.</label>
</div>
</div>
<button type="submit"><em>Submit</em></button>
</form>
</div>
<hr className="w-full mx-auto border h-[1px] mb-14" />
<Typography
variant="h4"
color="dark"
weight="semibold"
underlineColor="primary-100"
className="mb-6"
>
{t('faq:contactFormTitle')}
</Typography>
<ContactForm action={t('faq:contactFormActionUrl')} />
</div>
<Push/>
</Container>
Expand Down
54 changes: 54 additions & 0 deletions src/components/Form/Field/Field.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import Label from "@/components/Form/Label/Label";
import Input from "@/components/Form/Input/Input";
import classNames from "classnames";

interface Field {
variant?: 'input' | 'textarea';
label: string;
labelPosition?: 'left' | 'right' | 'top'
id?: string;
name: string;
type?: string;
required: boolean;
placeholder?: string;
value?: string;
className?: string;
}

const wrapperClass = {
left: 'flex flex-row',
right: 'flex flex-row-reverse justify-end',
top: 'flex flex-col'
}
const labelClass = {
left: 'mr-2',
right: 'ml-2',
top: 'block mb-2'
};
const inputClass = {
left: '',
right: '',
top: 'block w-full'
};

const Field = ({ variant = 'input', label, labelPosition = 'top', id, name, type, required, placeholder, value, className }: Field) => {
return (
<div className={classNames(wrapperClass[labelPosition], className)}>
<Label required={required} className={labelClass[labelPosition]}>
{label}
</Label>
<Input
variant={variant}
type={type}
id={id}
name={name}
required={required}
placeholder={placeholder}
value={value}
className={inputClass[labelPosition]}
/>
</div>
);
};

export default Field;
39 changes: 39 additions & 0 deletions src/components/Form/Input/Input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import classNames from "classnames";

interface Input {
variant: 'input' | 'textarea';
type?: string;
id?: string;
name: string;
required: boolean;
placeholder?: string;
value?: string;
className?: string;
}

const Input = ({ variant, type = 'text', id, name, required, placeholder, value, className }: Input) => {
const classHtml = classNames(
'border rounded-md border-primary bg-white py-2 px-4 text-base font-normal',
className
);
if (variant === 'textarea') {
return (
<textarea
className={classHtml}
id={id}
name={name}
required={required}
placeholder={placeholder}
rows={4}
>
{value}
</textarea>
);
}

return (
<input className={classHtml} type={type} id={id} name={name} required={required} placeholder={placeholder} value={value}/>
);
};

export default Input;
22 changes: 22 additions & 0 deletions src/components/Form/Label/Label.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ReactNode } from "react";
import classNames from "classnames";

interface Label {
required: boolean;
className?: string;
children?: ReactNode;
}

const Label = ({ required, className, children }: Label) => {
return (
<label className={classNames(
"text-base font-semibold",
className
)}>
{children}
{required && (<em className="text-red-700 not-italic ml-1">*</em>)}
</label>
);
};

export default Label;
77 changes: 77 additions & 0 deletions src/layouts/Form/ContactForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import Form from "next/form";
import Field from "@/components/Form/Field/Field";
import { useTranslation } from "react-i18next";
import Link from "next/link";
import Typography from "@/components/Typography/Typography";

interface Contact {
action: string
}

const ContactForm = ({ action }: Contact) => {
const { t } = useTranslation(['common']);

return (
<Form action={action} formMethod="POST" className="text-base text-black font-semibold">
{/* To Track referrals , place the referrer name within the " " in the above hidden input field */}
<input type="hidden" name="zf_referrer_name" value="mmfr-website"/>
{/* To redirect to a specific page after record submission , place the respective url within the " " in the above hidden input field */}
<input type="hidden" name="zf_redirect_url" value="https://meet-magento.opengento.fr/contact"/>
{/* If GCLID is enabled in Zoho CRM Integration, click details of AdWords Ads will be pushed to Zoho CRM */}
<input type="hidden" name="zc_gad" value=""/>

<div className="grid grid-cols-1 lg:grid-cols-2 gap-5">
<Field
label={t('common:Name')}
name="Name_First"
type="text"
required={true}
placeholder={t('common:fullname')}
/>
<Field
label={t('common:Email')}
name="Email"
type="email"
required={true}
/>
<Field
label={t('common:Objet')}
name="SingleLine"
type="text"
required={true}
className="lg:col-span-2"
/>
<Field
label={t('common:Message')}
name="MultiLine"
variant="textarea"
required={true}
placeholder={t('common:help')}
className="lg:col-span-2"
/>
<div className="lg:col-span-2">
<Field
label={t('common:agreeTerms')}
labelPosition="right"
name="TermsConditions"
type="checkbox"
required={true}
/>
<Typography variant="small" color="dark" className="my-2">
En cliquant sur “Soumettre”, j’autorise Meet Magento France à traiter mes données et à me
recontacter pour répondre à ma demande selon notre <Link className="underline" href="/mentions-legales#data-protection">
politique de confidentialité</Link>.
</Typography>
</div>
</div>
<button
type="submit"
className="bg-primary border border-white rounded-3xl text-white text-center hover:border-primary hover:bg-white hover:text-primary my-6 p-3 min-w-48 duration-300"
>
<span className="font-semibold">{t('common:send')}</span>
</button>
</Form>
);
};

export default ContactForm;

0 comments on commit 2237370

Please sign in to comment.