Skip to content

Commit

Permalink
Add semantic-object-key-val as argument for onHover prop
Browse files Browse the repository at this point in the history
  • Loading branch information
rtexelm committed Mar 27, 2024
1 parent a1d5c77 commit 5ca3c1b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ class Row extends React.PureComponent {
}

handleMenuHover = hovered => {
this.setState(() => ({ hoverMenuHovered: hovered }));
const { isHovered } = hovered;
this.setState(() => ({ hoverMenuHovered: isHovered }));
};

render() {
Expand Down
12 changes: 7 additions & 5 deletions superset-frontend/src/dashboard/components/menu/HoverMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface HoverMenuProps {
position: 'left' | 'top';
innerRef: RefObject<HTMLDivElement>;
children: React.ReactNode;
onHover?: (isHovered: boolean) => void;
onHover?: (data: { isHovered: boolean }) => void;
}

const HoverStyleOverrides = styled.div`
Expand Down Expand Up @@ -73,14 +73,16 @@ export default class HoverMenu extends React.PureComponent<HoverMenuProps> {
};

handleMouseEnter = () => {
if (this.props.onHover) {
this.props.onHover(true);
const { onHover } = this.props;
if (onHover) {
onHover({ isHovered: true });
}
};

handleMouseLeave = () => {
if (this.props.onHover) {
this.props.onHover(false);
const { onHover } = this.props;
if (onHover) {
onHover({ isHovered: false });
}
};

Expand Down

0 comments on commit 5ca3c1b

Please sign in to comment.