-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2-notification-pretty.jsx
More file actions
56 lines (48 loc) · 1.52 KB
/
2-notification-pretty.jsx
File metadata and controls
56 lines (48 loc) · 1.52 KB
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
// https://github.com/developering/prettier-demo/pull/1/files
import React from 'react';
import PropTypes from 'prop-types';
import CloseIcon from 'everydollar/elem/CloseIcon';
import { FormattedHTMLMessage } from 'react-intl';
import { NOTIFICATION_TYPE } from 'everydollar/configs/constants';
let Notification = props => (
<div
className={props.className}
onMouseOver={props.handleMouseOver}
onMouseLeave={props.handleMouseLeave}
>
{props.linkMessageId && (
<span className="Notification-action" onClick={props.handleLinkAction}>
<FormattedHTMLMessage
id={props.linkMessageId}
values={props.linkMessageValues}
/>
</span>
)}
<span className="Notification-message">
<FormattedHTMLMessage id={props.messageId} values={props.messageValues} />
</span>
<div className="Notification-close" onClick={props.handleClose}>
<span className="sr-only">Close</span>
<CloseIcon />
</div>
</div>
);
Notification.propTypes = {
type: PropTypes.string,
messageId: PropTypes.string.isRequired,
messageValues: PropTypes.object,
linkMessageId: PropTypes.string,
linkMessageValues: PropTypes.object,
className: PropTypes.string,
handleClose: PropTypes.func,
handleLinkAction: PropTypes.func,
handleMouseOver: PropTypes.func,
handleMouseLeave: PropTypes.func
};
Notification.defaultProps = {
type: NOTIFICATION_TYPE.STANDARD,
messageValues: {},
linkMessageValues: {}
};
Notification.displayName = 'Notification';
export default Notification;