mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-24 01:48:18 +03:00
24 lines
841 B
TypeScript
24 lines
841 B
TypeScript
import { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons';
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
import type { Placement } from '@popperjs/core';
|
|
import type { FC, PropsWithChildren } from 'react';
|
|
import { UncontrolledTooltip } from 'reactstrap';
|
|
import { useElementRef } from '../../../shlink-frontend-kit/src';
|
|
|
|
export type InfoTooltipProps = PropsWithChildren<{
|
|
className?: string;
|
|
placement: Placement;
|
|
}>;
|
|
|
|
export const InfoTooltip: FC<InfoTooltipProps> = ({ className = '', placement, children }) => {
|
|
const ref = useElementRef<HTMLSpanElement>();
|
|
|
|
return (
|
|
<>
|
|
<span className={className} ref={ref}>
|
|
<FontAwesomeIcon icon={infoIcon} />
|
|
</span>
|
|
<UncontrolledTooltip target={ref} placement={placement}>{children}</UncontrolledTooltip>
|
|
</>
|
|
);
|
|
};
|