mirror of
https://github.com/wassname/talk.git
synced 2026-07-13 17:45:56 +08:00
20 lines
462 B
JavaScript
20 lines
462 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import styles from './CountBadge.css';
|
|
import { humanizeNumber } from 'coral-framework/helpers/numbers';
|
|
|
|
const CountBadge = ({ count }) => {
|
|
let number = count;
|
|
|
|
// shorten large counts to abbreviations
|
|
number = humanizeNumber(number);
|
|
|
|
return <span className={styles.count}>{number}</span>;
|
|
};
|
|
|
|
CountBadge.propTypes = {
|
|
count: PropTypes.number.isRequired,
|
|
};
|
|
|
|
export default CountBadge;
|