import * as React from 'react'; import classNames from 'classnames'; import { Popup } from 'rc-tooltip'; import type { PopoverProps } from '.'; import { ConfigContext } from '../config-provider'; import useStyle from './style'; import { getRenderPropValue } from '../_util/getRenderPropValue'; export const getOverlay = ( prefixCls: string, title?: PopoverProps['title'], content?: PopoverProps['content'], ) => { if (!title && !content) return undefined; return ( <> {title &&
{getRenderPropValue(title)}
}
{getRenderPropValue(content)}
); }; export interface PurePanelProps extends Omit { children: React.ReactNode; } export default function PurePanel(props: any) { const { prefixCls: customizePrefixCls, className, placement = 'top', title, content } = props; const { getPrefixCls } = React.useContext(ConfigContext); const prefixCls = getPrefixCls('popover', customizePrefixCls); const [wrapSSR, hashId] = useStyle(prefixCls); return wrapSSR(
{getOverlay(prefixCls, title, content)}
, ); }