import React, { ReactNode, useState } from "react"; import StyledTooltip from "./StyledTooltip"; import StyledTooltipWrapper from "./StyledTooltipWrapper"; export type direction = "top" | "right" | "bottom" | "left"; type classes = { wrapper?: string; text?: string; }; export type StyledTooltipWrapperProps = { children: ReactNode; }; export type StyledTooltipProps = { color?: string; background?: string; direction: direction; }; export type TooltipProps = StyledTooltipWrapperProps & StyledTooltipProps & { classes?: classes; title: string; props?: any; }; const Tooltip: React.FC = ({ children, classes, color, background, direction = "top", title, ...props }) => { const [show, setShow] = useState(false); const showTooltip = () => setShow(true); const hideTooltip = () => setShow(false); return ( {children} {show && ( {title} )} ); }; export default Tooltip;