import * as React from 'react'; import type { PopconfirmProps } from '.'; import Button from '../button'; import { convertLegacyProps } from '../button/button'; import ActionButton from '../_util/ActionButton'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; import defaultLocale from '../locale/default'; import { getRenderPropValue } from '../_util/getRenderPropValue'; import { ConfigContext } from '../config-provider'; export interface PopconfirmLocale { okText: string; cancelText: string; } export interface OverlayProps extends Pick< PopconfirmProps, | 'icon' | 'okButtonProps' | 'cancelButtonProps' | 'cancelText' | 'okText' | 'okType' | 'showCancel' | 'title' > { prefixCls: string; close?: Function; onConfirm?: React.MouseEventHandler; onCancel?: React.MouseEventHandler; } export const Overlay: React.FC = props => { const { prefixCls, okButtonProps, cancelButtonProps, title, cancelText, okText, okType, icon, showCancel = true, close, onConfirm, onCancel, } = props; const { getPrefixCls } = React.useContext(ConfigContext); return ( {(popconfirmLocale: PopconfirmLocale) => (
{icon}
{getRenderPropValue(title)}
{showCancel && ( )} {okText || popconfirmLocale.okText}
)}
); };