aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/forms/flipping-label/flipping-label.stories.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-07 18:44:14 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commitd75b9a1e150ab211c1052fb49bede9bd16320aca (patch)
treee5bb221d2b8dc83151697fe646e9194f921b5807 /src/components/molecules/forms/flipping-label/flipping-label.stories.tsx
parent12a03a9a72f7895d571dbaeeb245d92aa277a610 (diff)
feat(components): add a generic Flip component
The flipping animation is used at several places so it makes sense to use a single component to handle the animation. It will avoid styles duplication.
Diffstat (limited to 'src/components/molecules/forms/flipping-label/flipping-label.stories.tsx')
-rw-r--r--src/components/molecules/forms/flipping-label/flipping-label.stories.tsx12
1 files changed, 7 insertions, 5 deletions
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 bf5724e..c3c4f9a 100644
--- a/src/components/molecules/forms/flipping-label/flipping-label.stories.tsx
+++ b/src/components/molecules/forms/flipping-label/flipping-label.stories.tsx
@@ -1,6 +1,6 @@
import type { ComponentMeta, ComponentStory } from '@storybook/react';
import { useCallback, useState } from 'react';
-import { Icon } from '../../../atoms';
+import { Button, Icon } from '../../../atoms';
import { FlippingLabel } from './flipping-label';
export default {
@@ -78,20 +78,22 @@ const Template: ComponentStory<typeof FlippingLabel> = ({
const updateState = useCallback(() => setActive((prev) => !prev), []);
return (
- <button onClick={updateState} type="button">
+ <Button kind="neutral" onClick={updateState} shape="initial" type="button">
<FlippingLabel {...args} isActive={active} />
- </button>
+ </Button>
);
};
export const Active = Template.bind({});
Active.args = {
- children: <Icon shape="magnifying-glass" />,
+ icon: <Icon shape="magnifying-glass" />,
isActive: true,
+ label: 'Close the search',
};
export const Inactive = Template.bind({});
Inactive.args = {
- children: <Icon shape="magnifying-glass" />,
+ icon: <Icon shape="magnifying-glass" />,
isActive: false,
+ label: 'Open the search',
};