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/field.tsx | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

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

diff --git a/src/components/atoms/forms/field.tsx b/src/components/atoms/forms/field.tsx
index 377e1b0..a4553e3 100644
--- a/src/components/atoms/forms/field.tsx
+++ b/src/components/atoms/forms/field.tsx
@@ -72,12 +72,7 @@ export type FieldProps = {
   value: string;
 };
 
-/**
- * Field component.
- *
- * Render either an input or a textarea.
- */
-const Field: ForwardRefRenderFunction<HTMLInputElement, FieldProps> = (
+const FieldWithRef: ForwardRefRenderFunction<HTMLInputElement, FieldProps> = (
   { className = '', setValue, type, ...props },
   ref
 ) => {
@@ -93,19 +88,24 @@ const Field: ForwardRefRenderFunction<HTMLInputElement, FieldProps> = (
 
   return type === 'textarea' ? (
     <textarea
-      onChange={updateValue}
-      className={`${styles.field} ${styles['field--textarea']} ${className}`}
       {...props}
+      className={`${styles.field} ${styles['field--textarea']} ${className}`}
+      onChange={updateValue}
     />
   ) : (
     <input
+      {...props}
       className={`${styles.field} ${className}`}
       onChange={updateValue}
       ref={ref}
       type={type}
-      {...props}
     />
   );
 };
 
-export default forwardRef(Field);
+/**
+ * Field component.
+ *
+ * Render either an input or a textarea.
+ */
+export const Field = forwardRef(FieldWithRef);
-- 
cgit v1.2.3

