diff --git a/scss/components/_context-menu.scss b/scss/components/_context-menu.scss index c7e220f96..1fc823a5d 100644 --- a/scss/components/_context-menu.scss +++ b/scss/components/_context-menu.scss @@ -93,6 +93,7 @@ background: linear-gradient(to bottom, #648bf5 0%, #2866f2 100%); border-top: 1px solid #5a82eb; border-bottom: 1px solid #1758e7; + cursor: pointer; } &.is-disabled > a { diff --git a/src/components/ContextMenu.tsx b/src/components/ContextMenu.tsx index d810f695c..b4136464d 100644 --- a/src/components/ContextMenu.tsx +++ b/src/components/ContextMenu.tsx @@ -30,6 +30,7 @@ export type MenuItem = { children?: Array; data?: any; onSelect?: (data: any) => void; + onHighlight?: (isHiglight: boolean, data: any) => void; }; export type MenuDivider = '|'; @@ -124,6 +125,14 @@ export class ContextMenu extends React.Component< ); } + handleMouseEnter(item: MenuItem) { + item.disabled || !item.onHighlight || item.onHighlight(true, item.data); + } + + handleMouseLeave(item: MenuItem) { + item.disabled || !item.onHighlight || item.onHighlight(false, item.data); + } + renderMenus(menus: Array) { const {classnames: cx} = this.props; @@ -141,7 +150,11 @@ export class ContextMenu extends React.Component< 'is-disabled': item.disabled })} > - + {item.icon ? : null} {item.label}