import React from "react"; import { Tooltip2 } from "@blueprintjs/popover2"; type Props = { tooltipHeading?: string; tooltipContent: string; position?: | "top" | "right" | "bottom" | "left" | "auto" | "auto-end" | "auto-start" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top" | "top-left" | "top-right"; children: JSX.Element; disabled?: boolean; className?: string; }; export const Tooltip: React.FC = ({ tooltipHeading, tooltipContent, position = "top", children, disabled = false, className = "", }) => ( {tooltipHeading ? ( <>
{tooltipHeading}

{tooltipContent}

) : (

{tooltipContent}

)} } position={position} renderTarget={({ isOpen: isTooltipOpen, ref: eleRefernce, ...tooltipProps }) => React.cloneElement(children, { ref: eleRefernce, ...tooltipProps, ...children.props }) } /> );