File size: 802 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
32
33
34
35
import { localize } from 'i18n-calypso';
import PropTypes from 'prop-types';

import './comment-count.scss';

const CommentCount = ( { count, translate } ) => {
	let countPhrase;
	if ( count > 0 ) {
		countPhrase = (
			<span className="comments__comment-count-phrase">
				{ translate( '%(commentCount)d comment', '%(commentCount)d comments', {
					count,
					args: {
						commentCount: count,
					},
				} ) }
			</span>
		);
	} else {
		countPhrase = translate( '{{span}}No comments{{/span}} - add the first!', {
			components: {
				span: <span className="comments__comment-count-phrase" />,
			},
		} );
	}

	return <div className="comments__comment-count">{ countPhrase }</div>;
};

CommentCount.propTypes = {
	count: PropTypes.number.isRequired,
};

export default localize( CommentCount );