Skip to content

Commit

Permalink
✨ feat(ActionIconGroup): items support disable props (#158)
Browse files Browse the repository at this point in the history
* feat(ActionIconGroup): items support disable

* feat(ActionIconGroup): dropdown
  • Loading branch information
huangkairan committed May 30, 2024
1 parent f7ed374 commit afb1472
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ActionIconGroup/demos/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const items: ActionIconGroupProps['items'] = [
label: 'Copy',
},
{
disable: true,
icon: RotateCw,
key: 'regenerate',
label: 'Regenerate',
Expand All @@ -21,6 +22,7 @@ export const dropdownMenu: ActionIconGroupProps['dropdownMenu'] = [
label: 'Copy',
},
{
disable: true,
icon: RotateCw,
key: 'regenerate',
label: 'Regenerate',
Expand Down
3 changes: 3 additions & 0 deletions src/ActionIconGroup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { DivProps } from '@/types';
import { useStyles } from './style';

export interface ActionIconGroupItems {
disable?: boolean;
icon: LucideIcon;
key: string;
label: string;
Expand Down Expand Up @@ -78,6 +79,7 @@ const ActionIconGroup = memo<ActionIconGroupProps>(
{items?.length > 0 &&
items.map((item) => (
<ActionIcon
disable={item.disable}
icon={item.icon}
key={item.key}
onClick={
Expand All @@ -97,6 +99,7 @@ const ActionIconGroup = memo<ActionIconGroupProps>(
if (item.type) return item;
return {
...item,
disabled: item.disable,
icon: <Icon icon={item.icon} size="small" />,
onClick: onActionClick
? (info: ActionEvent) =>
Expand Down

0 comments on commit afb1472

Please sign in to comment.