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 authored and GitHub committed 2021-07-21 08:08:39 -04:00
1 parent fe33296ba5
commit d52c4c3999
1 file changed
+16 -20
+16 -20
View File
@@ -74,32 +74,28 @@ export const HotbarIcon = observer(({menuItems = [], size = 40, tooltip, ...prop
setMenuOpen(!menuOpen);
};
const renderIcon = () => {
return (
<Avatar
{...rest}
title={title}
colorHash={`${title}-${source}`}
className={cssNames(active ? "active" : "default", { interactive: !!onClick })}
width={size}
height={size}
src={src}
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);
}
}}
>
{material && <Icon className="materialIcon" material={material}/>}
</Avatar>
);
};
return (
<div className={cssNames("HotbarIcon flex", className, { disabled, contextMenuAvailable: menuItems.length > 0 })}>
{tooltip && <Tooltip targetId={id}>{tooltip}</Tooltip>}
<div id={id}>
{renderIcon()}
<Avatar
{...rest}
title={title}
colorHash={`${title}-${source}`}
className={cssNames(active ? "active" : "default", { interactive: !!onClick })}
width={size}
height={size}
src={src}
>
{material && <Icon className="materialIcon" material={material} />}
</Avatar>
{children}
</div>
<Menu