import React from 'react' import Block from './Block' import Text from './Text' type ModalProps = { onOk?: () => void onCancel?: () => void renderIcon?: () => React.ReactNode renderSubtitle?: () => React.ReactNode subTitle?: string title?: string okText?: string cancelText?: string } /** * * 全局 modal 组件 * @export * @param {ModalProps} { onOk, onCancel, renderIcon, subTitle, title, renderSubtitle, okText = '确定', cancelText = '取消' } * @return {*} */ export default function Modal({ onOk, onCancel, renderIcon, subTitle, title, renderSubtitle, okText = '确定', cancelText = '取消', }: ModalProps) { const handleConfirm = () => { onOk?.() } const handleCancel = () => { onCancel?.() } return ( {renderIcon?.()} {!!title && {title}} {!!subTitle && ( {subTitle} )} {renderSubtitle?.()} {cancelText} {okText} ) }