aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/forms/contact-form.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-09-20 16:38:54 +0200
committerArmand Philippot <git@armandphilippot.com>2023-09-20 16:38:54 +0200
commitf861e6a269ba9f62700776d3cd13b644a9e836d4 (patch)
treea5a107e7a6e4ff8b4261fe04349357bc00b783ee /src/components/organisms/forms/contact-form.tsx
parent03331c44276ec56e9f235e4d5ee75030455a753f (diff)
refactor: use named export for everything except pages
Next expect a default export for pages so only those components should use default exports. Everything else should use named exports to reduce the number of import statements.
Diffstat (limited to 'src/components/organisms/forms/contact-form.tsx')
-rw-r--r--src/components/organisms/forms/contact-form.tsx44
1 files changed, 20 insertions, 24 deletions
diff --git a/src/components/organisms/forms/contact-form.tsx b/src/components/organisms/forms/contact-form.tsx
index b8dcb5e..ca84c25 100644
--- a/src/components/organisms/forms/contact-form.tsx
+++ b/src/components/organisms/forms/contact-form.tsx
@@ -1,9 +1,7 @@
import { FC, ReactNode, useState } from 'react';
import { useIntl } from 'react-intl';
-import Button from '../../atoms/buttons/button';
-import Form from '../../atoms/forms/form';
-import Spinner from '../../atoms/loaders/spinner';
-import LabelledField from '../../molecules/forms/labelled-field';
+import { Button, Form, Spinner } from '../../atoms';
+import { LabelledField } from '../../molecules';
import styles from './contact-form.module.scss';
export type ContactFormData = {
@@ -33,7 +31,7 @@ export type ContactFormProps = {
*
* Render a contact form.
*/
-const ContactForm: FC<ContactFormProps> = ({
+export const ContactForm: FC<ContactFormProps> = ({
className = '',
Notice,
sendMail,
@@ -94,45 +92,45 @@ const ContactForm: FC<ContactFormProps> = ({
};
return (
- <Form aria-label={formName} onSubmit={submitHandler} className={className}>
+ <Form aria-label={formName} className={className} onSubmit={submitHandler}>
<LabelledField
- type="text"
+ className={styles.field}
id="contact-name"
- name="contact-name"
label={nameLabel}
+ name="contact-name"
required={true}
- value={name}
setValue={setName}
- className={styles.field}
+ type="text"
+ value={name}
/>
<LabelledField
- type="email"
+ className={styles.field}
id="contact-email"
- name="contact-email"
label={emailLabel}
+ name="contact-email"
required={true}
- value={email}
setValue={setEmail}
- className={styles.field}
+ type="email"
+ value={email}
/>
<LabelledField
- type="text"
+ className={styles.field}
id="contact-object"
- name="contact-object"
label={objectLabel}
- value={object}
+ name="contact-object"
setValue={setObject}
- className={styles.field}
+ type="text"
+ value={object}
/>
<LabelledField
- type="textarea"
+ className={styles.field}
id="contact-message"
- name="contact-message"
label={messageLabel}
+ name="contact-message"
required={true}
- value={message}
setValue={setMessage}
- className={styles.field}
+ type="textarea"
+ value={message}
/>
<Button type="submit" kind="primary" className={styles.button}>
{intl.formatMessage({
@@ -154,5 +152,3 @@ const ContactForm: FC<ContactFormProps> = ({
</Form>
);
};
-
-export default ContactForm;