-
Notifications
You must be signed in to change notification settings - Fork 1
/
FunctionPopup.tsx
78 lines (73 loc) · 2.16 KB
/
FunctionPopup.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { Modal, Box, Typography, Button } from "@mui/material";
import "../styles/AddEnumModal.css";
const style = {
position: "absolute",
margin: "auto",
padding: 3,
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
width: "auto",
bgcolor: "#f1f1f1",
border: "2px solid #000",
borderRadius: 8,
boxShadow: 24,
p: 4,
};
const buttonStyle = {
marginRight: 10,
backgroundColor: "#404040",
};
const FunctionErrorPopup = ({
onClose,
error,
}: {
onClose: () => void;
error: string | Error;
}) => {
return (
<Modal
open={true}
onClose={onClose}
aria-labelledby="modal-modal-title"
aria-describedby="modal-modal-description"
>
<Box sx={style}>
<Typography id="modal-modal-title" variant="h5" component="h2">
Error
</Typography>
<Typography id="modal-modal-description" sx={{ mt: 2 }}>
It seems that an error occurred while trying to execute the function.
<br />
{error.toString()}
</Typography>
<Button variant="contained" style={buttonStyle} onClick={onClose}>
Close
</Button>
</Box>
</Modal>
);
};
const FunctionSuccessPopup = ({ onClose }: { onClose: () => void }) => {
return (
<Modal
open={true}
onClose={onClose}
aria-labelledby="modal-modal-title"
aria-describedby="modal-modal-description"
>
<Box sx={style}>
<Typography id="modal-modal-title" variant="h5" component="h2">
Success
</Typography>
<Typography id="modal-modal-description" sx={{ mt: 2 }}>
Your function was successfully executed.
</Typography>
<Button variant="contained" style={buttonStyle} onClick={onClose}>
Close
</Button>
</Box>
</Modal>
);
};
export { FunctionErrorPopup, FunctionSuccessPopup };