From f861e6a269ba9f62700776d3cd13b644a9e836d4 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Wed, 20 Sep 2023 16:38:54 +0200
Subject: 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.
---
 src/components/atoms/forms/form.tsx | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

(limited to 'src/components/atoms/forms/form.tsx')

diff --git a/src/components/atoms/forms/form.tsx b/src/components/atoms/forms/form.tsx
index 3307153..85ff8fd 100644
--- a/src/components/atoms/forms/form.tsx
+++ b/src/components/atoms/forms/form.tsx
@@ -1,23 +1,21 @@
-import { Children, FC, FormEvent, Fragment, ReactNode } from 'react';
+import {
+  Children,
+  FC,
+  FormEvent,
+  FormHTMLAttributes,
+  Fragment,
+  ReactNode,
+} from 'react';
 import styles from './forms.module.scss';
 
-export type FormProps = {
-  /**
-   * An accessible name.
-   */
-  'aria-label'?: string;
-  /**
-   * One or more ids that refers to the form name.
-   */
-  'aria-labelledby'?: string;
+export type FormProps = Omit<
+  FormHTMLAttributes<HTMLFormElement>,
+  'onSubmit'
+> & {
   /**
    * The form body.
    */
   children: ReactNode;
-  /**
-   * Set additional classnames to the form wrapper.
-   */
-  className?: string;
   /**
    * Wrap each items with a div. Default: true.
    */
@@ -37,7 +35,7 @@ export type FormProps = {
  *
  * Render children wrapped in a form element.
  */
-const Form: FC<FormProps> = ({
+export const Form: FC<FormProps> = ({
   children,
   grouped = true,
   itemsClassName = '',
@@ -75,10 +73,8 @@ const Form: FC<FormProps> = ({
   };
 
   return (
-    <form onSubmit={handleSubmit} {...props}>
+    <form {...props} onSubmit={handleSubmit}>
       {getFormItems()}
     </form>
   );
 };
-
-export default Form;
-- 
cgit v1.2.3

