UNPKG

@atlaskit/navigation-system

Version:

The latest navigation system for Atlassian apps.

53 lines • 1.44 kB
import _extends from "@babel/runtime/helpers/extends"; /** * @jsxRuntime classic */ import React, { forwardRef } from 'react'; import HelpIcon from '@atlaskit/icon/core/question-circle'; import { BadgeContainer } from '../../components/badge-container'; import { EndItem } from './end-item'; const HELP_NOTIFICATION_BADGE_ID = 'atlassian-navigation-help-notification-count'; /** * __Help__ * * The trigger button for the help menu in the top navigation bar. */ export const Help = /*#__PURE__*/forwardRef(function Help({ label, onClick, onMouseEnter, isSelected, testId, interactionName, isListItem, badge, shortcut }, ref) { const sharedProps = { icon: HelpIcon, label, onClick, onMouseEnter, isSelected, testId, interactionName, ref, shortcut }; if (!badge) { return /*#__PURE__*/React.createElement(EndItem, _extends({}, sharedProps, { isListItem: isListItem })); } return /*#__PURE__*/React.createElement(BadgeContainer, { id: HELP_NOTIFICATION_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, _extends({}, sharedProps, { // 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 }))); });