Updated notification badge number formatter

fixes: #44
This commit is contained in:
mgabdev 2019-07-16 14:50:37 -04:00
parent 17af572ec9
commit 45754503ca

View File

@ -1,14 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
import Icon from 'gabsocial/components/icon';
import { shortNumberFormat } from 'gabsocial/utils/numbers';
const formatNumber = num => num > 40 ? '40+' : num;
const IconWithBadge = ({ id, count, className }) => {
if (count < 1) return null;
const IconWithBadge = ({ id, count, className }) => (
return (
<i className='icon-with-badge'>
{count > 0 && <i className='icon-with-badge__badge'>{formatNumber(count)}</i>}
{count > 0 && <i className='icon-with-badge__badge'>{shortNumberFormat(count)}</i>}
</i>
);
)
};
IconWithBadge.propTypes = {
id: PropTypes.string.isRequired,