You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
680 B
23 lines
680 B
6 years ago
|
import React from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import Icon from 'flavours/glitch/components/icon';
|
||
|
|
||
|
const formatNumber = num => num > 40 ? '40+' : num;
|
||
|
|
||
4 years ago
|
const IconWithBadge = ({ id, count, issueBadge, className }) => (
|
||
6 years ago
|
<i className='icon-with-badge'>
|
||
5 years ago
|
<Icon id={id} fixedWidth className={className} />
|
||
6 years ago
|
{count > 0 && <i className='icon-with-badge__badge'>{formatNumber(count)}</i>}
|
||
4 years ago
|
{issueBadge && <i className='icon-with-badge__issue-badge' />}
|
||
6 years ago
|
</i>
|
||
|
);
|
||
|
|
||
|
IconWithBadge.propTypes = {
|
||
|
id: PropTypes.string.isRequired,
|
||
|
count: PropTypes.number.isRequired,
|
||
4 years ago
|
issueBadge: PropTypes.bool,
|
||
6 years ago
|
className: PropTypes.string,
|
||
|
};
|
||
|
|
||
|
export default IconWithBadge;
|