-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdropdownItem.stories.tsx
More file actions
73 lines (67 loc) · 1.91 KB
/
Copy pathdropdownItem.stories.tsx
File metadata and controls
73 lines (67 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Dropdown, type IDropdownItemProps } from '../index';
const meta: Meta<typeof Dropdown.Item> = {
title: 'Core/Components/Dropdown/Dropdown.Item',
component: Dropdown.Item,
argTypes: {
disabled: { control: 'boolean' },
},
parameters: {
design: {
type: 'figma',
url: 'https://www.figma.com/file/jfKRr1V9evJUp1uBeyP3Zz/v1.0.0?type=design&node-id=8072-35701&mode=design&t=6F2nZrphVItFNxRc-4',
},
},
};
type Story = StoryObj<typeof Dropdown.Item>;
/**
* Default usage of the DropdownItem component.
*/
export const Default: Story = {
render: (props: IDropdownItemProps) => (
<Dropdown.Container label="Dropdown">
<Dropdown.Item {...props} />
</Dropdown.Container>
),
args: {
children: 'Dropdown item label',
},
};
/**
* Set the `href` property to the DropdownItem component to render a link item.
*/
export const Link: Story = {
render: (props: IDropdownItemProps) => (
<Dropdown.Container label="Dropdown with link">
<Dropdown.Item {...props} />
</Dropdown.Container>
),
args: {
children: 'Dropdown link',
href: 'https://aragon.org',
target: '_blank',
},
};
/**
* Set the `formId` property to the DropdownItem component to render a button of type "submit".
*/
export const SubmitButton: Story = {
render: (props: IDropdownItemProps) => (
<form
id="form-id"
onSubmit={(e) => {
e.preventDefault();
alert('Form submitted');
}}
>
<Dropdown.Container label="Dropdown with link">
<Dropdown.Item {...props} />
</Dropdown.Container>
</form>
),
args: {
children: 'As submit button',
formId: 'form-id',
},
};
export default meta;