import React, { useRef } from 'react';
import { Modal as AModal } from 'antd';
import './index.less';

const Modal = ({ className = '', style, ...props }) => {
  const domRef = useRef(null);
  return (
    <>
      <div ref={domRef} style={{ position: 'fixed', zIndex: 200, left: 0, top: 0 }}></div>
      {React.cloneElement(<AModal style={{ ...style, textAlign: 'left' }} />, { className: `lm-modal-container ${className}`, getContainer: () => domRef.current, ...props })}
    </>
  );
};

Modal.info = AModal.info;
Modal.success = AModal.success;
Modal.error = AModal.error;
Modal.warn = AModal.warn;
Modal.warning = AModal.warning;
Modal.confirm = AModal.confirm;

export default Modal;
