-
-
Notifications
You must be signed in to change notification settings - Fork 227
/
Alert.jsx
42 lines (37 loc) · 977 Bytes
/
Alert.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
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import Modal from '../Modal';
import Button from '../Button';
class Alert extends PureComponent {
render() {
const { prefixCls, title, message, cancelText, 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>
</Modal.Footer>
</Modal>
);
}
}
Alert.propTypes = {
prefixCls: PropTypes.string,
animationType: Modal.propTypes.animationType,
message: PropTypes.string,
cancelText: PropTypes.string,
onCancel: PropTypes.func,
};
Alert.defaultProps = {
prefixCls: 'za-alert',
animationType: 'zoom',
message: '',
cancelText: '关闭',
onCancel() {},
};
export default Alert;