soapbox/app/gabsocial/components/icon_with_badge.js

22 wiersze
531 B
JavaScript
Czysty Zwykły widok Historia

2020-03-27 20:59:38 +00:00
import React from 'react';
import PropTypes from 'prop-types';
import { shortNumberFormat } from 'gabsocial/utils/numbers';
const IconWithBadge = ({ id, count, className }) => {
2020-04-14 18:44:40 +00:00
if (count < 1) return null;
2020-03-27 20:59:38 +00:00
2020-04-14 18:44:40 +00:00
return (
<i className='icon-with-badge'>
{count > 0 && <i className='icon-with-badge__badge'>{shortNumberFormat(count)}</i>}
</i>
);
2020-03-27 20:59:38 +00:00
};
IconWithBadge.propTypes = {
2020-04-14 18:44:40 +00:00
id: PropTypes.string.isRequired,
count: PropTypes.number.isRequired,
className: PropTypes.string,
2020-03-27 20:59:38 +00:00
};
export default IconWithBadge;