-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
greeting.js
41 lines (37 loc) · 1.37 KB
/
greeting.js
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
import React, {Component, PropTypes} from 'react';
import {FormattedMessage, FormattedNumber, FormattedRelative} from 'react-intl';
class Greeting extends Component {
render() {
const {user} = this.props;
return (
<p>
<FormattedMessage
id="greeting.welcome_message"
defaultMessage={`
Welcome {name}, you have received {unreadCount, plural,
=0 {no new messages}
one {{formattedUnreadCount} new message}
other {{formattedUnreadCount} new messages}
} since {formattedLastLoginTime}.
`}
values={{
name: <b>{user.name}</b>,
unreadCount: user.unreadCount,
formattedUnreadCount: (
<b>
<FormattedNumber value={user.unreadCount} />
</b>
),
formattedLastLoginTime: (
<FormattedRelative value={user.lastLoginTime} />
),
}}
/>
</p>
);
}
}
Greeting.propTypes = {
user: PropTypes.object.isRequired,
};
export default Greeting;