Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case "right":
horizontalPosition = HorizontalPosition.RIGHT;
horizontalSpacing = spacing;
break;
case "top":
verticalPosition = VerticalPosition.TOP;
verticalSpacing = spacing;
break;
case "bottom":
verticalPosition = VerticalPosition.BOTTOM;
verticalSpacing = spacing;
break;
}
this.setState({
style: positionRelativeTo(container, tooltip, {
horizontalPosition,
verticalPosition,
horizontalSpacing,
verticalSpacing,
isPortalFixed: portal || !!(portalIntoId || portalInto),
}),
position,
});
};
(node, isAppearing) => {
if (onEnter) {
onEnter(node, isAppearing);
}
setStyle(
positionRelativeTo(fixedToRef.current, node, optionsRef.current)
);
},
[onEnter]
function handleEnter(node: Maybe) {
const nextPosition = determineBestPosition(
container.current,
positionConfig
);
if (position !== nextPosition) {
setPosition(nextPosition);
}
if (!node || !portal) {
return;
}
const nextStyle = positionRelativeTo(
container.current,
node,
createPositionOptions(nextPosition, getSpacing(config))
);
setStyle(nextStyle);
}
private showTooltip = () => {
const container = this.container.current;
if (!container || this.state.visible) {
return;
}
const tooltip = document.getElementById(container.getAttribute("aria-describedby") as string);
this.setState({
tooltipStyle: positionRelativeTo(container, tooltip, {
verticalPosition: "below",
verticalSpacing: "1.5rem",
isPortalFixed: this.props.portal,
}),
visible: true,
});
};
private showTooltip = () => {
const container = this.container.current;
if (!container || this.state.visible) {
return;
}
const tooltip = document.getElementById(container.getAttribute("aria-describedby") as string);
this.setState({
tooltipStyle: positionRelativeTo(container, tooltip, {
verticalPosition: "below",
verticalSpacing: "1.5rem",
isPortalFixed: this.props.portal,
}),
visible: true,
});
};