@atlaskit/navigation-system
Version:
The latest navigation system for Atlassian apps.
44 lines (43 loc) • 1.65 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';
var 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 var AppSwitcher = /*#__PURE__*/forwardRef(function (_ref, ref) {
var label = _ref.label,
icon = _ref.icon,
onClick = _ref.onClick,
onMouseEnter = _ref.onMouseEnter,
interactionName = _ref.interactionName,
isSelected = _ref.isSelected,
testId = _ref.testId,
ariaControls = _ref['aria-controls'],
ariaExpanded = _ref['aria-expanded'],
ariaHasPopup = _ref['aria-haspopup'];
var 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
});
});