/**
 * @desc 模态框
 * @author denghuan
 */
import React from 'react';
import { Modal } from 'antd';
import classNames from 'classnames';
import { SuccessFilled, ErrorFilled, WarningFilled } from './icon';
const commonModalProps = {
    width: 300,
    centered: true,
};
const _Modal = { ...Modal };
function makeProps(props) {
    const { title, className, ...others } = props;
    return {
        title,
        className: title
            ? className
            : classNames(className, 'ant-modal-confirm-without-title'),
        ...commonModalProps,
        ...others,
    };
}
Modal.success = (props) => {
    const { icon = React.createElement(SuccessFilled, null), ...others } = props;
    return _Modal.success(makeProps({ icon, ...others }));
};
Modal.error = (props) => {
    const { icon = React.createElement(ErrorFilled, null), ...others } = props;
    return _Modal.error(makeProps({ icon, ...others }));
};
Modal.warning = (props) => {
    const { icon = React.createElement(WarningFilled, null), ...others } = props;
    return _Modal.warning(makeProps({ icon, ...others }));
};
Modal.confirm = (props) => {
    return _Modal.confirm(makeProps({ width: 482, ...props }));
};
Modal.info = (props) => {
    return _Modal.info(makeProps(props));
};
export default Modal;
