mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 19:02:15 +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 [style, setStyle] = React.useState(null);
|
||||||
|
|
||||||
const onTransitionEnd = React.useCallback(() => {
|
|
||||||
if (!active) {
|
|
||||||
setStyle(null);
|
|
||||||
}
|
|
||||||
}, [active]);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!ref.current) return setStyle(null);
|
if (!ref.current || !active) return setStyle(null);
|
||||||
|
|
||||||
const tooltipBounds = ref.current.getBoundingClientRect();
|
const tooltipBounds = ref.current.getBoundingClientRect();
|
||||||
const parentBounds = parent.getBoundingClientRect();
|
const parentBounds = parent.getBoundingClientRect();
|
||||||
|
|
@ -47,7 +41,7 @@ const TooltipItem = React.memo(({ className, active, label, position, margin, pa
|
||||||
}, [active, position, margin, parent, label]);
|
}, [active, position, margin, parent, label]);
|
||||||
|
|
||||||
return (
|
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 }
|
{ label }
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue