import { Modal } from 'antd';
import styles from './index.less';
import { Exclamtion } from '../Icons/Icons';
interface IDeletePromptModalProps {
  title: string;
  open: boolean;
  setOpen: (value: boolean) => void;
  tip: string;
  content: string;
  handleDeletePrompt: () => void;
  loading?: boolean;
}

const DeletePromptModal = (props: IDeletePromptModalProps) => {
  const { title, open, setOpen, tip, content, loading, handleDeletePrompt } = props;

  const handleSavePrompt = async () => {
    await handleDeletePrompt();
    setOpen(false);
  };

  return (
    <Modal
      title={title}
      okText="确认"
      open={open}
      onOk={handleSavePrompt}
      onCancel={() => {
        setOpen(false);
      }}
      confirmLoading={loading}
    >
      <div className={styles.deleteTitle}>
        <Exclamtion /> {tip}
      </div>
      <div className={styles.deleteContent}>{content}</div>
    </Modal>
  );
};

export default DeletePromptModal;
