From 84a679b0e48ed76eee2fa44d3caac83591aa3c8c Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 30 Oct 2023 11:18:11 +0100
Subject: feat(hooks): add useBoolean and useToggle hooks

---
 .../molecules/forms/flipping-label/flipping-label.stories.tsx      | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'src/components/molecules/forms/flipping-label/flipping-label.stories.tsx')

diff --git a/src/components/molecules/forms/flipping-label/flipping-label.stories.tsx b/src/components/molecules/forms/flipping-label/flipping-label.stories.tsx
index c3c4f9a..906a488 100644
--- a/src/components/molecules/forms/flipping-label/flipping-label.stories.tsx
+++ b/src/components/molecules/forms/flipping-label/flipping-label.stories.tsx
@@ -1,5 +1,5 @@
 import type { ComponentMeta, ComponentStory } from '@storybook/react';
-import { useCallback, useState } from 'react';
+import { useToggle } from '../../../../utils/hooks';
 import { Button, Icon } from '../../../atoms';
 import { FlippingLabel } from './flipping-label';
 
@@ -74,11 +74,10 @@ const Template: ComponentStory<typeof FlippingLabel> = ({
   isActive,
   ...args
 }) => {
-  const [active, setActive] = useState<boolean>(isActive);
-  const updateState = useCallback(() => setActive((prev) => !prev), []);
+  const [active, toggle] = useToggle(isActive);
 
   return (
-    <Button kind="neutral" onClick={updateState} shape="initial" type="button">
+    <Button kind="neutral" onClick={toggle} shape="initial" type="button">
       <FlippingLabel {...args} isActive={active} />
     </Button>
   );
-- 
cgit v1.2.3

