@atlaskit/navigation-system
Version:
The latest navigation system for Atlassian apps.
49 lines • 1.49 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';
const NOTIFICATIONS_BADGE_ID = 'atlassian-navigation-notification-count';
/**
* __Notifications__
*
* The trigger button for the notifications menu in the top navigation bar.
*/
export const Notifications = /*#__PURE__*/forwardRef(function Notifications({
label,
onClick,
onMouseEnter,
isSelected,
testId,
interactionName,
'aria-controls': ariaControls,
'aria-expanded': ariaExpanded,
'aria-haspopup': ariaHasPopup,
isListItem,
badge,
shortcut
}, ref) {
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
}));
});