From e26d821f738525477472e631d170d9ed218c1603 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 25 Feb 2022 19:17:09 +0100
Subject: chore: combine input/textarea/select in a single component

---
 src/components/FormElements/Form/Form.tsx | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 src/components/FormElements/Form/Form.tsx

(limited to 'src/components/FormElements/Form/Form.tsx')

diff --git a/src/components/FormElements/Form/Form.tsx b/src/components/FormElements/Form/Form.tsx
new file mode 100644
index 0000000..10fdcdf
--- /dev/null
+++ b/src/components/FormElements/Form/Form.tsx
@@ -0,0 +1,27 @@
+import { ReactNode } from 'react';
+import styles from './Form.module.scss';
+
+type FormKind = 'centered' | 'search' | 'settings';
+
+const Form = ({
+  children,
+  submitHandler,
+  kind,
+  id,
+}: {
+  children: ReactNode;
+  submitHandler: any;
+  kind?: FormKind;
+  id?: string;
+}) => {
+  const kindStyles = kind ? styles[kind] : '';
+  const classes = `${styles.wrapper} ${kindStyles}`;
+
+  return (
+    <form onSubmit={submitHandler} className={classes} id={id}>
+      {children}
+    </form>
+  );
+};
+
+export default Form;
-- 
cgit v1.2.3

