@atlaskit/navigation-system
Version:
The latest navigation system for Atlassian apps.
48 lines • 1.69 kB
JavaScript
import React, { forwardRef } from 'react';
import NotificationsIcon from '@atlaskit/icon/core/notification';
import { BadgeContainer } from '../../components/badge-container';
import { EndItem } from './end-item';
var NOTIFICATIONS_BADGE_ID = 'atlassian-navigation-notification-count';
/**
* __Notifications__
*
* The trigger button for the notifications menu in the top navigation bar.
*/
export var Notifications = /*#__PURE__*/forwardRef(function Notifications(_ref, ref) {
var label = _ref.label,
onClick = _ref.onClick,
onMouseEnter = _ref.onMouseEnter,
isSelected = _ref.isSelected,
testId = _ref.testId,
interactionName = _ref.interactionName,
ariaControls = _ref['aria-controls'],
ariaExpanded = _ref['aria-expanded'],
ariaHasPopup = _ref['aria-haspopup'],
isListItem = _ref.isListItem,
badge = _ref.badge,
shortcut = _ref.shortcut;
return /*#__PURE__*/React.createElement(BadgeContainer, {
id: NOTIFICATIONS_BADGE_ID,
badge: badge
// We only need to set the list item role on the top level element (BadgeContainer)
,
isListItem: isListItem
}, /*#__PURE__*/React.createElement(EndItem, {
label: label,
onClick: onClick,
onMouseEnter: onMouseEnter,
isSelected: isSelected,
testId: testId,
interactionName: interactionName,
"aria-controls": ariaControls,
"aria-expanded": ariaExpanded,
"aria-haspopup": ariaHasPopup,
ref: ref,
icon: NotificationsIcon
// We explicitly set the EndItem to not be a list item,
// because the BadgeContainer already has a list item role (if `isListItem` is true)
,
isListItem: false,
shortcut: shortcut
}));
});