forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
statistic_count.tsx
43 lines (39 loc) · 1.3 KB
/
statistic_count.tsx
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
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {ReactNode} from 'react';
import {FormattedMessage} from 'react-intl';
type Props = {
title: ReactNode;
icon: string;
count?: number;
id?: string;
}
export default class StatisticCount extends React.PureComponent<Props> {
public render(): JSX.Element {
const loading = (
<FormattedMessage
id='analytics.chart.loading'
defaultMessage='Loading...'
/>
);
return (
<div className='col-lg-3 col-md-4 col-sm-6'>
<div className='total-count'>
<div
data-testid={`${this.props.id}Title`}
className='title'
>
{this.props.title}
<i className={'fa ' + this.props.icon}/>
</div>
<div
data-testid={this.props.id}
className='content'
>
{typeof this.props.count === 'undefined' || isNaN(this.props.count) ? loading : this.props.count}
</div>
</div>
</div>
);
}
}