gab-social/app/javascript/gabsocial/components/notification_counter.js
2020-02-25 11:04:44 -05:00

25 lines
487 B
JavaScript

import { shortNumberFormat } from '../../utils/numbers';
const mapStateToProps = state => ({
count: state.getIn(['notifications', 'unread']),
});
export default
@connect(mapStateToProps)
class NotificationCounter extends PureComponent {
static propTypes = {
count: PropTypes.number.isRequired,
};
render() {
const { count } = this.props;
if (count < 1) return null;
return (
<span className='notification-counter'>{shortNumberFormat(count)}</span>
);
}
}