@atlaskit/navigation-system
Version:
The latest navigation system for Atlassian apps.
45 lines (44 loc) • 1.49 kB
JavaScript
import React, { forwardRef } from 'react';
import AppSwitcherIcon from '@atlaskit/icon/core/app-switcher';
import { fg } from '@atlaskit/platform-feature-flags/fg';
import { IconButton } from './themed/icon-button';
const toggleButtonTooltipOptions = {
// We're disabling pointer events on the tooltip to prevent it from blocking mouse events, so that the side nav flyout stays open
// when moving the mouse from the top bar to the side nav.
ignoreTooltipPointerEvents: true
};
/**
* __App switcher__
*
* The trigger button for the app switcher. Allows users to switch between Atlassian products.
*/
export const AppSwitcher = /*#__PURE__*/forwardRef(({
label,
icon,
onClick,
onMouseEnter,
interactionName,
isSelected,
testId,
'aria-controls': ariaControls,
'aria-expanded': ariaExpanded,
'aria-haspopup': ariaHasPopup
}, ref) => {
const pickedAppSwitcherIcon = fg('platform_dst_ads_appswitcher_improvements') ? icon !== null && icon !== void 0 ? icon : AppSwitcherIcon : AppSwitcherIcon;
return /*#__PURE__*/React.createElement(IconButton, {
ref: ref,
"aria-controls": ariaControls,
"aria-expanded": ariaExpanded,
"aria-haspopup": ariaHasPopup,
icon: pickedAppSwitcherIcon,
label: label,
appearance: "subtle",
onClick: onClick,
onMouseEnter: onMouseEnter,
interactionName: interactionName,
isTooltipDisabled: false,
tooltip: toggleButtonTooltipOptions,
isSelected: isSelected,
testId: testId
});
});