From 2b70c89962a18f33995fcca762fed73fd5ce8f28 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 1 Apr 2022 22:46:07 +0200
Subject: chore: add labelled field component

---
 src/components/molecules/forms/labelled-field.tsx | 25 +++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 src/components/molecules/forms/labelled-field.tsx

(limited to 'src/components/molecules/forms/labelled-field.tsx')

diff --git a/src/components/molecules/forms/labelled-field.tsx b/src/components/molecules/forms/labelled-field.tsx
new file mode 100644
index 0000000..7f81e23
--- /dev/null
+++ b/src/components/molecules/forms/labelled-field.tsx
@@ -0,0 +1,25 @@
+import Field, { type FieldProps } from '@components/atoms/forms/field';
+import Label from '@components/atoms/forms/label';
+import { FC } from 'react';
+
+type LabelledFieldProps = FieldProps & {
+  label: string;
+};
+
+const LabelledField: FC<LabelledFieldProps> = ({
+  id,
+  label,
+  required,
+  ...props
+}) => {
+  return (
+    <>
+      <Label htmlFor={id} required={required}>
+        {label}
+      </Label>
+      <Field id={id} required={required} {...props} />
+    </>
+  );
+};
+
+export default LabelledField;
-- 
cgit v1.2.3

