Skip to content

Commit

Permalink
chore: stories
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanVor committed Feb 16, 2024
1 parent c4ffe24 commit 93eb9f6
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions src/components/Table/__stories__/Table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,30 +128,27 @@ const WithTableActionsTemplate: StoryFn<TableProps<DataItem>> = (args) => {
handler: () => {},
},
];
return <TableWithAction {...args} getRowActions={getRowActions} />;
};
export const HOCWithTableActions = WithTableActionsTemplate.bind({});

// ---------------------------------
const WithTableActionsRenderRowActionsTemplate: StoryFn<TableProps<DataItem>> = (args) => {
return (
<TableWithAction
{...args}
renderRowActions={({index}) => {
if (index % 2) {
return null;
}

const items = ['action 1', 'action 2', 'action 3'];
return <TreeSelect items={items} size="s" />;
}}
/>
<React.Fragment>
<h3>{'with getRowActions property'}</h3>
<TableWithAction {...args} getRowActions={getRowActions} />
<br />
<h3>{'with renderRowActions property'}</h3>
<TableWithAction
{...args}
renderRowActions={({index}) => {
if (index % 2) {
return null;
}

const items = ['action 1', 'action 2', 'action 3'];
return <TreeSelect items={items} size="s" />;
}}
/>
</React.Fragment>
);
};
export const HOCWithTableActionsRenderRowActions = WithTableActionsRenderRowActionsTemplate.bind(
{},
);
// ---------------------------------
export const HOCWithTableActions = WithTableActionsTemplate.bind({});

// ---------------------------------
const columnsWithCopy = _cloneDeep(columns);
Expand Down

0 comments on commit 93eb9f6

Please sign in to comment.