Skip to content

Commit fc19d73

Browse files
committed
Refactor TableRowMenu stories
1 parent a6597c0 commit fc19d73

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed
Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
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";
33

4-
export default {
4+
const meta: Meta<typeof TableRowMenu> = {
55
title: "components/TableRowMenu",
66
component: TableRowMenu,
7-
} as ComponentMeta<typeof TableRowMenu>;
8-
9-
type DataType = {
10-
id: string;
117
};
128

13-
const Template: Story<TableRowMenuProps<DataType>> = (args) => (
14-
<TableRowMenu {...args} />
15-
);
9+
export default meta;
10+
type Story = StoryObj<typeof TableRowMenu<{ id: string }>>;
1611

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+
},
2622
};

0 commit comments

Comments
 (0)