import React, { Component } from "react";
import ReactDom from "react-dom";
import style from "./index.less";
import Notify from '@commonComp/Notify';
import close from '@common/images/icon_close.png';
/**
 * title:标题
 * children：弹窗内容
 * onClose:弹窗关闭事件
 * shadeClose:点蒙层关闭，默认true
 *footer:固定在弹窗底部的内容如确定按钮
 *
 * **/

class ComplexModal extends Component {
  constructor(props) {
    super(props)
  }
  render() {
    const { onclose,title,children,footer,shadeClose} = this.props;
    const domNode = document.getElementById('root');
    return ReactDom.createPortal(<div className={style['container']}>
      <div className={style['shade']} onClick={shadeClose===false?'':onclose}></div>
      <div className={style['modal']}>
        <div className={style['close']}>
          {title}
          <img src={close} onClick={onclose} />
        </div>
        <div className={style["content"]}>{children}</div>
        <div className={style['footer']}>{footer}</div>
      </div>
    </div>,domNode);
  }
}

export default ComplexModal;
