1
0
puyopuyotetr.is/app/javascript/mastodon/features/ui/components/notifications_counter_icon.js
Eugen Rochko 1e5532e693
Add responsive panels to the single-column layout (#10820)
* Add responsive panels to the single-column layout

* Fixes

* Fix not being able to save the preference

* Fix code style issues

* Set max-height on the compose textarea and add a link to relationship manager
2019-05-25 21:27:00 +02:00

25 lines
717 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import Icon from 'mastodon/components/icon';
const mapStateToProps = state => ({
count: state.getIn(['notifications', 'unread']),
});
const formatNumber = num => num > 99 ? '99+' : num;
const NotificationsCounterIcon = ({ count, className }) => (
<i className='icon-with-badge'>
<Icon id='bell' fixedWidth className={className} />
{count > 0 && <i className='icon-with-badge__badge'>{formatNumber(count)}</i>}
</i>
);
NotificationsCounterIcon.propTypes = {
count: PropTypes.number.isRequired,
className: PropTypes.string,
};
export default connect(mapStateToProps)(NotificationsCounterIcon);