import ReactTooltip from 'react-tooltip'; import clsx from 'clsx'; import _ from 'lodash'; import ReactDOMServer from 'react-dom/server'; import { FeatureId } from '@/react/portainer/feature-flags/enums'; import { getFeatureDetails } from '@@/BEFeatureIndicator/utils'; import styles from './TooltipWithChildren.module.css'; type Position = 'top' | 'right' | 'bottom' | 'left'; export interface Props { position?: Position; message: string; className?: string; children: React.ReactNode; heading?: string; BEFeatureID?: FeatureId; } export function TooltipWithChildren({ message, position = 'bottom', className, children, heading, BEFeatureID, }: Props) { const id = _.uniqueId('tooltip-'); const { url, limitedToBE } = BEFeatureID ? getFeatureDetails(BEFeatureID) : { url: '', limitedToBE: false }; const messageHTML = (
{heading && {heading}} {BEFeatureID && limitedToBE && ( Business Edition Only )}
{message}
); return ( {children} ); }