Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Table): add table action icon #510

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/components/Table/__stories__/Table.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import {Meta, Story} from '@storybook/react';
import {Table, TableProps} from '../Table';
import {action} from '@storybook/addon-actions';
import _cloneDeep from 'lodash/cloneDeep';
import {Table, TableProps} from '../Table';
import {
data,
columns,
Expand All @@ -13,7 +14,8 @@ import {
DataItem,
} from './utils';
import {TableAction, TableSettingsData} from '..';
import {action} from '@storybook/addon-actions';
import {GearIcon} from '../../icons';
import {Icon} from '../../Icon';

export default {
title: 'Components/Table',
Expand Down Expand Up @@ -85,6 +87,11 @@ const WithTableActionsTemplate: Story<TableProps<DataItem>> = (args) => {
action('default')(handlerArgs);
},
},
{
text: 'with icon',
icon: <Icon data={GearIcon} size={14} />,
handler: () => {},
},
{
text: 'disabled',
disabled: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface TableAction<I> {
) => void;
disabled?: boolean;
theme?: MenuItemProps['theme'];
icon?: MenuItemProps['icon'];
}

export interface TableActionGroup<I> {
Expand Down Expand Up @@ -165,6 +166,7 @@ export function withTableActions<I extends TableDataItem, E extends {} = {}>(
disabled={action.disabled}
onClick={this.handleActionClick.bind(this, action, popupData!)}
theme={action.theme}
icon={action.icon}
className={bPopup('menu-item')}
>
{action.text}
Expand Down