aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/toolbar/settings.stories.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-26 21:55:55 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:15:27 +0100
commit3ab9f0423e97af63da4bf6a13ffd786955bd5b3b (patch)
tree53866337f2e2b0bd47ada82f0f35799595663108 /src/components/organisms/toolbar/settings.stories.tsx
parent795b92cc1a168c48c7710ca6e0e1ef5974013d95 (diff)
refactor(hooks,providers): rewrite useAckee hook and AckeeProvider
Diffstat (limited to 'src/components/organisms/toolbar/settings.stories.tsx')
-rw-r--r--src/components/organisms/toolbar/settings.stories.tsx29
1 files changed, 7 insertions, 22 deletions
diff --git a/src/components/organisms/toolbar/settings.stories.tsx b/src/components/organisms/toolbar/settings.stories.tsx
index bea0d9e..66b4e0f 100644
--- a/src/components/organisms/toolbar/settings.stories.tsx
+++ b/src/components/organisms/toolbar/settings.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 { Settings } from './settings';
/**
@@ -9,20 +9,9 @@ export default {
title: 'Organisms/Toolbar/Settings',
component: Settings,
args: {
- ackeeStorageKey: 'ackee-tracking',
motionStorageKey: 'reduced-motion',
},
argTypes: {
- ackeeStorageKey: {
- control: {
- type: 'text',
- },
- description: 'Set Ackee settings local storage key.',
- type: {
- name: 'string',
- required: true,
- },
- },
className: {
control: {
type: 'text',
@@ -92,15 +81,11 @@ const Template: ComponentStory<typeof Settings> = ({
}) => {
const [isOpen, setIsOpen] = useState<boolean>(isActive);
- return (
- <Settings
- isActive={isOpen}
- setIsActive={() => {
- setIsOpen(!isOpen);
- }}
- {...args}
- />
- );
+ const toggle = useCallback(() => {
+ setIsOpen((prevState) => !prevState);
+ }, []);
+
+ return <Settings isActive={isOpen} setIsActive={toggle} {...args} />;
};
/**