mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
fix: tooltips style position issue
This commit is contained in:
parent
03ee936e86
commit
0baec6535b
1 changed files with 2 additions and 8 deletions
|
|
@ -10,14 +10,8 @@ const TooltipItem = React.memo(({ className, active, label, position, margin, pa
|
|||
|
||||
const [style, setStyle] = React.useState(null);
|
||||
|
||||
const onTransitionEnd = React.useCallback(() => {
|
||||
if (!active) {
|
||||
setStyle(null);
|
||||
}
|
||||
}, [active]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!ref.current) return setStyle(null);
|
||||
if (!ref.current || !active) return setStyle(null);
|
||||
|
||||
const tooltipBounds = ref.current.getBoundingClientRect();
|
||||
const parentBounds = parent.getBoundingClientRect();
|
||||
|
|
@ -47,7 +41,7 @@ const TooltipItem = React.memo(({ className, active, label, position, margin, pa
|
|||
}, [active, position, margin, parent, label]);
|
||||
|
||||
return (
|
||||
<div ref={ref} className={classNames(className, styles['tooltip-item'], { 'active': active })} style={style} onTransitionEnd={onTransitionEnd}>
|
||||
<div ref={ref} className={classNames(className, styles['tooltip-item'], { 'active': active })} style={style}>
|
||||
{ label }
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue