Added InfoTooltip test

This commit is contained in:
Alejandro Celaya
2021-08-23 18:26:15 +02:00
parent 410d372755
commit 9887cae4fd
2 changed files with 46 additions and 7 deletions

View File

@@ -10,16 +10,14 @@ interface InfoTooltipProps {
}
export const InfoTooltip: FC<InfoTooltipProps> = ({ className = '', placement, children }) => {
const ref = useRef<HTMLElement | null>();
const ref = useRef<HTMLSpanElement | null>();
const refCallback = (el: HTMLSpanElement) => {
ref.current = el;
};
return (
<>
<span
className={className}
ref={(el) => {
ref.current = el;
}}
>
<span className={className} ref={refCallback}>
<FontAwesomeIcon icon={infoIcon} />
</span>
<UncontrolledTooltip target={(() => ref.current) as any} placement={placement}>{children}</UncontrolledTooltip>