import React, { ReactNode, useRef } from 'react' import Button from '../Button' import { useLangData } from '../ConfigProvider' import { concat } from '../utils' import { TipIcon } from '../icons' import { PopupContainerProvider } from '../PopupContainerProvider' import { PopoverButtons, PopoverProps } from '.' export type InnerProps = Pick & { prefix: string icon?: true | ReactNode buttons?: true | PopoverButtons close(): void } export default function Inner({ icon, title, content, prefix, buttons, close }: InnerProps) { const iconPrefix = concat(prefix, 'icon') const mainPrefix = concat(prefix, 'main') const titlePrefix = concat(mainPrefix, 'title') const contentPrefix = concat(mainPrefix, 'content') const btnsPrefix = concat(mainPrefix, 'btns') const ref = useRef(null) icon = icon === true ? : icon return ( <> {icon &&
{icon}
}
{title &&
{title}
}
{content}
{buttons && }
) } type ButtonsProps = PopoverButtons & { prefix?: string close(): void } function Buttons(props: ButtonsProps) { const langData = useLangData('modal') const { prefix, onCancel, onOk, cancelButtonProps, okButtonProps, cancelText = langData.cancelText, okText = langData.okText, close } = props function handleCancel(event: React.MouseEvent) { close() onCancel?.(event) } function handleOk(event: React.MouseEvent) { close() onOk?.(event) } return (
) }