aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/forms/fields/checkbox
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-11-03 12:22:47 +0100
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:15:27 +0100
commit5d3e8a4d0c2ce2ad8f22df857ab3ce54fcfc38ac (patch)
treea758333b29e2e6614de609acb312ea9ff0d3a33b /src/components/atoms/forms/fields/checkbox
parent655be4404630a20ae4ca40c4af84afcc2e63557b (diff)
refactor(components): replace Toolbar with Navbar component
* remove SearchModal and SettingsModal components * add a generic NavbarItem component (instead of the previous toolbar items to avoid unreadable styles...) * move FlippingLabel component logic into NavbarItem since it is only used here
Diffstat (limited to 'src/components/atoms/forms/fields/checkbox')
-rw-r--r--src/components/atoms/forms/fields/checkbox/checkbox.tsx15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/components/atoms/forms/fields/checkbox/checkbox.tsx b/src/components/atoms/forms/fields/checkbox/checkbox.tsx
index 9c175b7..2a8424e 100644
--- a/src/components/atoms/forms/fields/checkbox/checkbox.tsx
+++ b/src/components/atoms/forms/fields/checkbox/checkbox.tsx
@@ -1,14 +1,19 @@
-import type { FC } from 'react';
+import { forwardRef, type ForwardRefRenderFunction } from 'react';
import { BooleanField, type BooleanFieldProps } from '../boolean-field';
export type CheckboxProps = Omit<BooleanFieldProps, 'type'>;
+const CheckboxWithRef: ForwardRefRenderFunction<
+ HTMLInputElement,
+ CheckboxProps
+> = (props, ref) => (
+ // eslint-disable-next-line react/jsx-no-literals -- Type allowed
+ <BooleanField {...props} ref={ref} type="checkbox" />
+);
+
/**
* Checkbox component
*
* Render a checkbox input type.
*/
-export const Checkbox: FC<CheckboxProps> = (props) => (
- // eslint-disable-next-line react/jsx-no-literals -- Type allowed
- <BooleanField {...props} type="checkbox" />
-);
+export const Checkbox = forwardRef(CheckboxWithRef);