Skip to content

Commit

Permalink
Add DropdownMenu story for DropdownMenu Component
Browse files Browse the repository at this point in the history
  • Loading branch information
roshni73 authored and barshathakuri committed May 16, 2024
1 parent 02479c8 commit ef4245a
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
73 changes: 73 additions & 0 deletions packages/go-ui-storybook/src/stories/Dropdown.stories.tsx
Original file line number Diff line number Diff line change
@@ -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<DropdownMenuSpecificProps>;

const meta: Meta<typeof DropdownMenu> = {
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 (
<DropdownMenu
// eslint-disable-next-line react/jsx-props-no-spreading
{...componentArgs}
/>
);
},
],
};

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',
},
};
14 changes: 14 additions & 0 deletions packages/go-ui-storybook/src/stories/DropdownMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
DropdownMenu as PureDropdownMenu,
DropdownMenuProps as PureDropdownMenuProps,
} from '@ifrc-go/ui';

type DropdownMenuProps = PureDropdownMenuProps

function WrappedDropdownMenu(props: DropdownMenuProps) {
return (
<PureDropdownMenu {...props} />// eslint-disable-line react/jsx-props-no-spreading
);
}

export default WrappedDropdownMenu;

0 comments on commit ef4245a

Please sign in to comment.