Skip to content

Commit

Permalink
narrow context menu item icon type to only eui iconType variants and …
Browse files Browse the repository at this point in the history
…ReactElement
  • Loading branch information
eokoneyo committed May 31, 2024
1 parent 3eda6af commit bbf6e95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/eui/changelogs/upcoming/7804.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Modify `EuiContextMenuItemIcon` type definition to explicitly define support for EuiIcon's icon definition (i.e `IconType`)
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import {
} from '../../services';
import { validateHref } from '../../services/security/href_validator';
import { CommonProps, keysOf } from '../common';
import { EuiIcon } from '../icon';
import { EuiIcon, type IconType } from '../icon';
import { EuiToolTip, EuiToolTipProps } from '../tool_tip';

import { euiContextMenuItemStyles } from './context_menu_item.styles';

export type EuiContextMenuItemIcon = ReactElement<any> | string | HTMLElement;
export type EuiContextMenuItemIcon = IconType | ReactElement<any>;

export type EuiContextMenuItemLayoutAlignment = 'center' | 'top' | 'bottom';

Expand Down Expand Up @@ -124,7 +124,7 @@ export const EuiContextMenuItem: FunctionComponent<Props> = ({
/>
) : (
// Assume it's already an instance of an icon.
cloneElementWithCss(icon as ReactElement, {
cloneElementWithCss(icon, {
css: styles.euiContextMenu__icon,
})
));
Expand Down

0 comments on commit bbf6e95

Please sign in to comment.