parent
17af572ec9
commit
45754503ca
@ -1,14 +1,17 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Icon from 'gabsocial/components/icon';
|
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'>
|
<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>
|
</i>
|
||||||
);
|
)
|
||||||
|
};
|
||||||
|
|
||||||
IconWithBadge.propTypes = {
|
IconWithBadge.propTypes = {
|
||||||
id: PropTypes.string.isRequired,
|
id: PropTypes.string.isRequired,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user