1
|
import { Card, Modal, Typography, Upload } from 'antd';
|
2
|
import 'antd/dist/antd.css';
|
3
|
import React from 'react';
|
4
|
|
5
|
interface ModalProps {
|
6
|
onCancel: () => void;
|
7
|
documentName: string;
|
8
|
content: string;
|
9
|
}
|
10
|
|
11
|
/**
|
12
|
* Creates a modal window that loads documents to the app.
|
13
|
* @returns The modal window.
|
14
|
*/
|
15
|
const DocPreviewModal: React.FC<ModalProps> = ({ onCancel, documentName, content }) => {
|
16
|
/**
|
17
|
* Handles successful closing of the modal window.
|
18
|
*/
|
19
|
const handleOk = () => {
|
20
|
onCancel();
|
21
|
};
|
22
|
|
23
|
/**
|
24
|
* Handles cancelling of the model window.
|
25
|
*/
|
26
|
const handleCancel = () => {
|
27
|
onCancel();
|
28
|
};
|
29
|
|
30
|
return (
|
31
|
<Modal
|
32
|
title={<Typography.Title level={3}>{documentName}</Typography.Title>}
|
33
|
// title={documentName}
|
34
|
onOk={handleOk}
|
35
|
visible={true}
|
36
|
onCancel={handleCancel}
|
37
|
footer={null}
|
38
|
width={1200}
|
39
|
maskClosable={false}
|
40
|
>
|
41
|
<Card style={{ overflowY: 'auto', maxHeight: '70vh' }}>
|
42
|
<div dangerouslySetInnerHTML={{ __html: content ?? '' }} />
|
43
|
</Card>
|
44
|
</Modal>
|
45
|
);
|
46
|
};
|
47
|
|
48
|
export default DocPreviewModal;
|