forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
statistic_count.jsx
47 lines (40 loc) · 1.2 KB
/
statistic_count.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
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import PropTypes from 'prop-types';
import React from 'react';
import {FormattedMessage} from 'react-intl';
export default class StatisticCount extends React.PureComponent {
static propTypes = {
/*
* Statistic title
*/
title: PropTypes.node.isRequired,
/*
* Statistic icon
*/
icon: PropTypes.string.isRequired,
/*
* Data count
*/
count: PropTypes.number,
}
render() {
const loading = (
<FormattedMessage
id='analytics.chart.loading'
defaultMessage='Loading...'
/>
);
return (
<div className='col-md-3 col-sm-6'>
<div className='total-count'>
<div className='title'>
{this.props.title}
<i className={'fa ' + this.props.icon}/>
</div>
<div className='content'>{isNaN(this.props.count) ? loading : this.props.count}</div>
</div>
</div>
);
}
}