Skip to content

Commit 3cde813

Browse files
authored
Merge pull request #9 from eshan25/eshan
Added confirmation box
2 parents 1a58698 + f6872e7 commit 3cde813

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/UploadAlt.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ function UploadAlt() {
1616
// console.log(file[0]);
1717
}
1818

19-
19+
const showModal = () => {
20+
setIsModalVisible(true);
21+
};
22+
23+
const handleCancel = () => {
24+
setIsModalVisible(false);
25+
};
26+
2027
const handleSubmit = (e) => {
2128
const fr = new FileReader();
2229
fr.onload = function (e) {
@@ -25,6 +32,7 @@ function UploadAlt() {
2532
setfileDataContent(text);
2633
console.log(fileDataContent);
2734
};
35+
2836
fr.readAsText(fileData);
2937
axios({
3038
method: "post",
@@ -55,9 +63,21 @@ function UploadAlt() {
5563
<Button type="primary" onClick={showModal} style={{marginTop: "50px"}}>
5664
Upload
5765
</Button>
58-
66+
<Modal
67+
title="Confirmation"
68+
visible={isModalVisible}
69+
onOk={handleSubmit}
70+
onCancel={handleCancel}>
71+
style={{
72+
overflow: 'auto',
73+
borderRadius: '10px',
74+
backgroundColor: '#1890ff',
75+
}}
76+
<p>Are you sure to upload the following file?</p>
77+
{fileData && <p>File: {fileData.name}</p>}
78+
</Modal>
5979
</Card>
6080
</div>
6181
);
6282
}
63-
export default UploadAlt;
83+
export default UploadAlt;

0 commit comments

Comments
 (0)