From fb860884857da73ee5b5e897745301cdf1d770a2 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Thu, 5 Oct 2023 18:58:30 +0200
Subject: refactor(components): make form components compliant with Eslint
 rules

---
 .../forms/fields/boolean-field/boolean-field.stories.tsx  | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

(limited to 'src/components/atoms/forms/fields/boolean-field/boolean-field.stories.tsx')

diff --git a/src/components/atoms/forms/fields/boolean-field/boolean-field.stories.tsx b/src/components/atoms/forms/fields/boolean-field/boolean-field.stories.tsx
index cb017da..60dd352 100644
--- a/src/components/atoms/forms/fields/boolean-field/boolean-field.stories.tsx
+++ b/src/components/atoms/forms/fields/boolean-field/boolean-field.stories.tsx
@@ -1,5 +1,5 @@
-import { ComponentMeta, ComponentStory } from '@storybook/react';
-import { useState } from 'react';
+import type { ComponentMeta, ComponentStory } from '@storybook/react';
+import { useCallback, useState } from 'react';
 import { BooleanField } from './boolean-field';
 
 /**
@@ -138,15 +138,12 @@ const Template: ComponentStory<typeof BooleanField> = ({
   ...args
 }) => {
   const [isChecked, setIsChecked] = useState(checked);
+  const handleChange = useCallback(() => {
+    setIsChecked((prev) => !prev);
+  }, []);
 
   return (
-    <BooleanField
-      isChecked={isChecked}
-      onChange={() => {
-        setIsChecked(!isChecked);
-      }}
-      {...args}
-    />
+    <BooleanField isChecked={isChecked} onChange={handleChange} {...args} />
   );
 };
 
-- 
cgit v1.2.3

