/*
 * @Author: your name
 * @Date: 2022-01-12 15:26:43
 * @LastEditTime: 2023-06-20 14:58:15
 * @LastEditors: code4eat awesomedema@gmail.com
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /KC-MiddlePlatform/src/components/KCModal/index.tsx
 */

import React, { useState, useEffect } from 'react';
import { ModalForm } from '@ant-design/pro-form';
import { KCModalType } from './typing';

const KCModal: React.FC<KCModalType.KCModalProps> = ({
  visible = false,
  modalProps,
  ...props
}) => {
  const [modalVisible, setModalVisible] = useState(false);

  useEffect(() => {
    setModalVisible(visible);
  }, [visible]);

  return (
    <ModalForm
      visible={modalVisible}
      modalProps={{
        destroyOnClose: true,
        bodyStyle: {
          maxHeight: '72vh',
          overflowY: 'auto',
          overflowX:'hidden'
        },
        ...modalProps,
      }}
      {...props}
    />
  );
};

export default KCModal;
