/*
 * @Author: your name
 * @Date: 2021-04-26 11:42:56
 * @LastEditTime: 2021-04-30 21:38:26
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /react-antd-admin-template/src/components/Modal/modal.js
 */
import React from 'react';
import { Modal } from 'antd';

class ModalWrap extends React.Component {
//   state = { visible: false };

  constructor(props){
      super(props);
      this.state = {
        visible:props.show
      }
      
  }

  showModal = () => {
    this.setState({
      visible: true,
    });
  };

  handleOk = e => {
    const {
        handleOkCallback=()=>{}
    } = this.props;

    handleOkCallback();
    // this.setState({
    //   visible: false,
    // });
  };

  handleCancel = e => {
    
    this.setState({
      visible: false,
    });
  };



  render() {
    
    return (
      <div>
        {/* <Button type="primary" onClick={this.showModal}>
          Open Modal
        </Button> */}
        <Modal
          title="Basic Modal"
          visible={this.state.visible}
          onOk={this.handleOk}
          onCancel={this.handleCancel}
          width={this.props.width}
        >
          {/* {
              this.props.component&&this.props.component()
          } */}
          {this.props.children}
        </Modal>
      </div>
    );
  }
}

export default ModalWrap;