@atlaskit/atlassian-navigation
Version:
A horizontal navigation component for Atlassian products.
35 lines (34 loc) • 1.42 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["badge", "tooltip"];
import React, { forwardRef } from 'react';
import NotificationIcon from '@atlaskit/icon/glyph/notification';
import { BadgeContainer } from '../BadgeContainer';
import { IconButton } from '../IconButton';
var NOTIFICATIONS_BADGE_ID = 'atlassian-navigation-notification-count';
/**
* __Notifications__
*
* A notifications button that can be passed into `AtlassianNavigation`'s
* `renderNotifications` prop.
*
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#notifications)
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
*/
export var Notifications = /*#__PURE__*/forwardRef(function (props, ref) {
var badge = props.badge,
tooltip = props.tooltip,
iconButtonProps = _objectWithoutProperties(props, _excluded);
return /*#__PURE__*/React.createElement(BadgeContainer, {
id: NOTIFICATIONS_BADGE_ID,
badge: badge
}, /*#__PURE__*/React.createElement(IconButton, _extends({
icon: /*#__PURE__*/React.createElement(NotificationIcon, {
label: typeof tooltip === 'string' ? tooltip : 'Notification Icon'
}),
tooltip: tooltip,
ref: ref,
"aria-describedby": NOTIFICATIONS_BADGE_ID
}, iconButtonProps)));
});
export default Notifications;