import React, { Fragment } from 'react'
import ModalFooter from '../d_modalFooter'
import { Modal, Button } from 'antd'

import styles from './style.module.less'

export default function modalTip(props) {
  const { title, content, footer, onClose, onOk, children, width = 500, closable = true, mask = true, maskClosable = false } = props
  const list = [
    <Button key="back" onClick={(e) => onClose(e)}>
      取消
    </Button>,
    <Button key="submit" type="primary" onClick={(e) => onOk(e)}>
      确定
    </Button>
  ]
  return (
    <Modal
      title={<Fragment><span className={styles.bluePillar} /> {title}</Fragment>}
      visible={true}
      closable={closable} // 是否显示右上角的关闭按钮
      mask={mask} // 是否展示遮罩
      maskClosable={maskClosable} // 点击蒙层是否允许关闭
      centered
      width={width}
      className={styles.modal}
      onCancel={(e) => onClose(e)}
      footer={
        <ModalFooter ButtonList={footer ? footer : list} />
      }
    >
      <div className={styles.modalContent}>
        {content}
      </div>
    </Modal>
  )
}