-
-
Notifications
You must be signed in to change notification settings - Fork 227
/
Confirm.jsx
47 lines (42 loc) · 1.14 KB
/
Confirm.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
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import Modal from '../Modal';
import Button from '../Button';
class Confirm extends PureComponent {
render() {
const { prefixCls, title, message, okText, cancelText, onOk, onCancel, ...others } = this.props;
return (
<Modal {...others}>
<Modal.Header title={title} />
<Modal.Body>
<div className={prefixCls}>
{message}
</div>
</Modal.Body>
<Modal.Footer>
<Button block bordered onClick={onCancel}>{cancelText}</Button>
<Button block bordered theme="primary" onClick={onOk}>{okText}</Button>
</Modal.Footer>
</Modal>
);
}
}
Confirm.propTypes = {
prefixCls: PropTypes.string,
animationType: Modal.propTypes.animationType,
message: PropTypes.string,
okText: PropTypes.string,
cancelText: PropTypes.string,
onOk: PropTypes.func,
onCancel: PropTypes.func,
};
Confirm.defaultProps = {
prefixCls: 'za-confirm',
animationType: 'zoom',
message: '',
okText: '确定',
cancelText: '取消',
onOk() {},
onCancel() {},
};
export default Confirm;