-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DropdownMenu story for DropdownMenu Component
- Loading branch information
1 parent
02479c8
commit ef4245a
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |