diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-10-30 11:18:11 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-11 18:15:27 +0100 |
| commit | 84a679b0e48ed76eee2fa44d3caac83591aa3c8c (patch) | |
| tree | 1d418a6c514ff8a04b84ba35c98736e8450f968c /src/components/organisms/toolbar/search.stories.tsx | |
| parent | 60c49f18389ff625177a57277ef8f292a31097bf (diff) | |
feat(hooks): add useBoolean and useToggle hooks
Diffstat (limited to 'src/components/organisms/toolbar/search.stories.tsx')
| -rw-r--r-- | src/components/organisms/toolbar/search.stories.tsx | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/components/organisms/toolbar/search.stories.tsx b/src/components/organisms/toolbar/search.stories.tsx index 2c8dd10..0f211bd 100644 --- a/src/components/organisms/toolbar/search.stories.tsx +++ b/src/components/organisms/toolbar/search.stories.tsx @@ -1,5 +1,5 @@ -import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { useState } from 'react'; +import type { ComponentMeta, ComponentStory } from '@storybook/react'; +import { useToggle } from '../../../utils/hooks'; import { Search } from './search'; /** @@ -66,17 +66,9 @@ const Template: ComponentStory<typeof Search> = ({ setIsActive: _setIsActive, ...args }) => { - const [isOpen, setIsOpen] = useState<boolean>(isActive); + const [isOpen, toggle] = useToggle(isActive); - return ( - <Search - isActive={isOpen} - setIsActive={() => { - setIsOpen(!isOpen); - }} - {...args} - /> - ); + return <Search isActive={isOpen} setIsActive={toggle} {...args} />; }; /** |
