import React, { useRef } from 'react'
import ReactTooltip from 'react-tooltip'
import FeatherIcon from 'feather-icons-react'
import classnames from 'classnames'
// @ts-ignore
export const overrideToolTipPosition = ({ left, top }, currentEvent, currentTarget, node) => {
const d = document.documentElement
left = Math.min(d.clientWidth - node.clientWidth, left)
top = Math.min(d.clientHeight - node.clientHeight, top)
left = Math.max(0, left)
top = Math.max(0, top)
return { top, left }
}
export const Tooltip = (props) => {
const {
children,
tip,
className,
iconClassName,
iconSizeClassName,
id,
place,
effect,
toolTipClassName,
isEnabled,
style
} = props
const ref = useRef(null)
if (!isEnabled) {
return children
}
if (!id) {
console.warn('Component requires an id! with children: ', children)
}
return (
<>
{children || (
)}
{tip}
>
)
}
Tooltip.defaultProps = {
effect: 'solid',
iconSizeClassName: 'w-4 h-4',
isEnabled: true,
place: 'top'
}