|
1 |
| -import { ComponentMeta, Story } from "@storybook/react"; |
2 |
| -import { TableRowMenu, TableRowMenuProps } from "./TableRowMenu"; |
| 1 | +import { TableRowMenu } from "./TableRowMenu"; |
| 2 | +import type { Meta, StoryObj } from "@storybook/react"; |
3 | 3 |
|
4 |
| -export default { |
| 4 | +const meta: Meta<typeof TableRowMenu> = { |
5 | 5 | title: "components/TableRowMenu",
|
6 | 6 | component: TableRowMenu,
|
7 |
| -} as ComponentMeta<typeof TableRowMenu>; |
8 |
| - |
9 |
| -type DataType = { |
10 |
| - id: string; |
11 | 7 | };
|
12 | 8 |
|
13 |
| -const Template: Story<TableRowMenuProps<DataType>> = (args) => ( |
14 |
| - <TableRowMenu {...args} /> |
15 |
| -); |
| 9 | +export default meta; |
| 10 | +type Story = StoryObj<typeof TableRowMenu<{ id: string }>>; |
16 | 11 |
|
17 |
| -export const Example = Template.bind({}); |
18 |
| -Example.args = { |
19 |
| - data: { id: "123" }, |
20 |
| - menuItems: [ |
21 |
| - { label: "Suspend", onClick: (data) => alert(data.id), disabled: false }, |
22 |
| - { label: "Update", onClick: (data) => alert(data.id), disabled: false }, |
23 |
| - { label: "Delete", onClick: (data) => alert(data.id), disabled: false }, |
24 |
| - { label: "Explode", onClick: (data) => alert(data.id), disabled: true }, |
25 |
| - ], |
| 12 | +export const Example: Story = { |
| 13 | + args: { |
| 14 | + data: { id: "123" }, |
| 15 | + menuItems: [ |
| 16 | + { label: "Suspend", onClick: (data) => alert(data.id), disabled: false }, |
| 17 | + { label: "Update", onClick: (data) => alert(data.id), disabled: false }, |
| 18 | + { label: "Delete", onClick: (data) => alert(data.id), disabled: false }, |
| 19 | + { label: "Explode", onClick: (data) => alert(data.id), disabled: true }, |
| 20 | + ], |
| 21 | + }, |
26 | 22 | };
|
0 commit comments