import React from 'react'
import ModalFooter from './components/ModalFooter'
import { Modal } from 'antd'
import './index.less'

export default class ModalView extends React.Component {
  render() {
    const { className, onOk, disabled, onCancel, onFootCancel, hasFooter = true, otherModalFooter = null, children = null, okText = '确认', cancelText = '取消', ...props } = this.props
    return (
      <Modal className={`modal-component ${className}`} {...props} onCancel={onCancel} footer={null}>
        <div className="modal-content">{children}</div>
        {otherModalFooter ? otherModalFooter : hasFooter && <ModalFooter okText={okText} cancelText={cancelText} onCancel={onFootCancel || onCancel} disabled={disabled} onOk={onOk} />}
      </Modal>
    )
  }
}
