From ef4245ab7261cc4e13a71b8692a493807b7fccab Mon Sep 17 00:00:00 2001 From: roshni73 Date: Fri, 10 May 2024 15:33:09 +0545 Subject: [PATCH] Add DropdownMenu story for DropdownMenu Component --- .../src/stories/Dropdown.stories.tsx | 73 +++++++++++++++++++ .../src/stories/DropdownMenu.tsx | 14 ++++ 2 files changed, 87 insertions(+) create mode 100644 packages/go-ui-storybook/src/stories/Dropdown.stories.tsx create mode 100644 packages/go-ui-storybook/src/stories/DropdownMenu.tsx diff --git a/packages/go-ui-storybook/src/stories/Dropdown.stories.tsx b/packages/go-ui-storybook/src/stories/Dropdown.stories.tsx new file mode 100644 index 000000000..f20363602 --- /dev/null +++ b/packages/go-ui-storybook/src/stories/Dropdown.stories.tsx @@ -0,0 +1,73 @@ +import { DropdownMenuProps } from '@ifrc-go/ui'; +import type { + Meta, + StoryObj, +} from '@storybook/react'; + +import DropdownMenu from './DropdownMenu'; + +type DropdownMenuSpecificProps = DropdownMenuProps & { + name: string; +}; + +type Story = StoryObj; + +const meta: Meta = { + title: 'Components/DropdownMenu', + component: DropdownMenu, + parameters: { + layout: 'centered', + design: { + type: 'figma', + url: 'https://www.figma.com/file/myeW85ibN5p2SlnXcEpxFD/IFRC-GO---UI-Current---1?type=design&node-id=0-4957&mode=design&t=KwxbuoUQxqcLyZbG-0', + }, + }, + tags: ['autodocs'], + decorators: [ + function Component(_, ctx) { + const componentArgs = ctx.args as DropdownMenuSpecificProps; + + return ( + + ); + }, + ], +}; + +export default meta; + +export const Default: Story = { + args: { + label: 'Click me', + children: 'Spanish', + }, +}; + +export const WithoutDropdownIcon: Story = { + args: { + label: 'Click me', + withoutDropdownIcon: true, + children: 'Spanish', + }, +}; + +export const Persistent: Story = { + args: { + label: 'Click me', + persistent: true, + children: 'Spanish', + + }, +}; + +export const Variant: Story = { + args: { + label: 'Click me', + persistent: true, + variant: 'primary', + children: 'Spanish', + }, +}; diff --git a/packages/go-ui-storybook/src/stories/DropdownMenu.tsx b/packages/go-ui-storybook/src/stories/DropdownMenu.tsx new file mode 100644 index 000000000..dcfd889e0 --- /dev/null +++ b/packages/go-ui-storybook/src/stories/DropdownMenu.tsx @@ -0,0 +1,14 @@ +import { + DropdownMenu as PureDropdownMenu, + DropdownMenuProps as PureDropdownMenuProps, +} from '@ifrc-go/ui'; + +type DropdownMenuProps = PureDropdownMenuProps + +function WrappedDropdownMenu(props: DropdownMenuProps) { + return ( + // eslint-disable-line react/jsx-props-no-spreading + ); +} + +export default WrappedDropdownMenu;