-
Notifications
You must be signed in to change notification settings - Fork 0
/
WarnModal.jsx
54 lines (51 loc) · 1.62 KB
/
WarnModal.jsx
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
import React, { Component } from 'react';
import { withStyles } from '@material-ui/core/styles';
import Modal from '@material-ui/core/Modal';
import Fade from '@material-ui/core/Fade';
import DialogContent from '@material-ui/core/DialogContent';
import Button from '@material-ui/core/Button';
import clxs from 'clsx';
import Icon from '../../components/Icon/Icon';
class WarnModal extends Component {
render() {
const { cancelMsg, acceptMsg, isOpen, onAccept, classes, children } = this.props;
let { onClose, onCancel } = this.props;
if (!onClose) onClose = onCancel;
if (!onCancel) onCancel = onClose;
return (
<div className="custom_modal">
<Modal className={classes.modal} open={isOpen} closeAfterTransition>
<Fade in={isOpen}>
<DialogContent>
<Icon icon="cancel" onClick={onClose} popoverText="Close Modal" />
<div className="modal_content">{children}</div>
<div className={clxs('modal_buttons', classes.buttons)}>
<Button className="modal_buttons--cancel" onClick={onCancel}>
{cancelMsg ? cancelMsg : 'Cancel'}
</Button>
<Button className="modal_buttons--accept" onClick={onAccept}>
{acceptMsg ? acceptMsg : 'Accept'}
</Button>
</div>
</DialogContent>
</Fade>
</Modal>
</div>
);
}
}
export default withStyles((theme) => ({
modal: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
},
buttons: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: theme.palette.background.main,
fontFamily: theme.typography.fontFamily,
fontWeight: 'bolder'
}
}))(WarnModal);