1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix onRun not executing everywhere :hover is defined for HotbarIcon (#3316)

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-07-21 08:08:39 -04:00 committed by GitHub
parent fe33296ba5
commit d52c4c3999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,8 +74,17 @@ export const HotbarIcon = observer(({menuItems = [], size = 40, tooltip, ...prop
setMenuOpen(!menuOpen); setMenuOpen(!menuOpen);
}; };
const renderIcon = () => {
return ( return (
<div className={cssNames("HotbarIcon flex", className, { disabled, contextMenuAvailable: menuItems.length > 0 })}>
{tooltip && <Tooltip targetId={id}>{tooltip}</Tooltip>}
<div
id={id}
onClick={(event) => {
if (!disabled) {
onClick?.(event);
}
}}
>
<Avatar <Avatar
{...rest} {...rest}
title={title} title={title}
@ -84,22 +93,9 @@ export const HotbarIcon = observer(({menuItems = [], size = 40, tooltip, ...prop
width={size} width={size}
height={size} height={size}
src={src} src={src}
onClick={(event) => {
if (!disabled) {
onClick?.(event);
}
}}
> >
{material && <Icon className="materialIcon" material={material}/>} {material && <Icon className="materialIcon" material={material} />}
</Avatar> </Avatar>
);
};
return (
<div className={cssNames("HotbarIcon flex", className, { disabled, contextMenuAvailable: menuItems.length > 0 })}>
{tooltip && <Tooltip targetId={id}>{tooltip}</Tooltip>}
<div id={id}>
{renderIcon()}
{children} {children}
</div> </div>
<Menu <Menu