d2-ui
Version:
48 lines (40 loc) • 1.57 kB
JavaScript
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
import React from 'react';
import IconButton from 'material-ui/IconButton';
import Badge from 'material-ui/Badge';
import SvgIcon from '../../svg-icon/SvgIcon';
import styles from '../header-bar-styles';
var NotificationItem = function NotificationItem(props) {
var count = props.count;
if (count && count > 0) {
return React.createElement(
Badge,
{
secondary: true,
badgeContent: count > 99 ? '99+' : count,
style: styles.notificationBadge,
badgeStyle: styles.notificationBadgeIcon
},
React.createElement(NotificationIcon, props)
);
}
return React.createElement(NotificationIcon, props);
};
var NotificationIcon = function NotificationIcon(_ref) {
var icon = _ref.icon,
href = _ref.href,
tooltip = _ref.tooltip,
_ref$style = _ref.style,
style = _ref$style === undefined ? {} : _ref$style;
return React.createElement(
IconButton,
{
href: href,
style: _extends({}, styles.notificationButton, style),
iconStyle: styles.notificationIcon,
tooltip: tooltip
},
React.createElement(SvgIcon, { icon: icon })
);
};
export default NotificationItem;