File size: 733 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import clsx from 'clsx';
import { localize } from 'i18n-calypso';
import PropTypes from 'prop-types';
import { PureComponent } from 'react';

import './style.scss';

class StatsError extends PureComponent {
	static displayName = 'StatsError';

	static propTypes = {
		message: PropTypes.string,
		className: PropTypes.string,
	};

	render() {
		const { children, className, message, translate } = this.props;
		const displayedMessage =
			message || translate( "Some stats didn't load in time. Please try again later." );

		return (
			<div className={ clsx( 'module-content-text', 'is-error', className ) }>
				<p key="primary">{ displayedMessage }</p>
				{ children }
			</div>
		);
	}
}

export default localize( StatsError );