Skip to content

Commit

Permalink
persistent tooltips on denominate full sum ( keep tooltip visible whi…
Browse files Browse the repository at this point in the history
…le hovering on hooltip )
  • Loading branch information
radumojic committed Oct 30, 2023
1 parent 8ab59ea commit 63b5a15
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions src/components/Denominate/Denominate.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useState, useRef } from 'react';
import { stringIsInteger } from '@multiversx/sdk-dapp/utils/validation/stringIsInteger';
import { OverlayTrigger, Tooltip } from 'react-bootstrap';
import { useSelector } from 'react-redux';
Expand All @@ -24,19 +25,40 @@ const CompleteValueTooltip = ({
}: {
completeValue: string;
children: React.ReactNode;
}) => (
<OverlayTrigger
placement='top'
delay={{ show: 0, hide: 400 }}
overlay={(props: any) => (
<Tooltip {...props} show={props.show.toString()}>
{completeValue}
</Tooltip>
)}
>
<span>{children}</span>
</OverlayTrigger>
);
}) => {
const [show, setShow] = useState(false);
const handleOnMouseEnter = () => {
setShow(true);
};
const handleOnMouseLeave = () => {
setShow(false);
};
const ref = useRef(null);

return (
<OverlayTrigger
placement='top'
show={show}
delay={{ show: 0, hide: 400 }}
overlay={
<Tooltip
onMouseEnter={handleOnMouseEnter}
onMouseLeave={handleOnMouseLeave}
>
{completeValue}
</Tooltip>
}
>
<span
ref={ref}
onMouseEnter={handleOnMouseEnter}
onMouseLeave={handleOnMouseLeave}
>
{children}
</span>
</OverlayTrigger>
);
};

const denominateInvalid = (props: DenominateType) => {
return (
Expand Down

0 comments on commit 63b5a15

Please sign in to comment.