UNPKG

@atlaskit/navigation-system

Version:

The latest navigation system for Atlassian apps.

46 lines • 1.65 kB
import React, { forwardRef, Fragment } from 'react'; import { ListItem } from '../../components/list-item'; import { IconButton } from './themed/icon-button'; /** * __EndItem__ * * An icon button for the `TopNavEnd` layout area of the top navigation. Used for adding custom actions that are not already provided. * * For common actions, like `Notifications`, `Help`, `Profile`, `Settings`, use the provided components as appropriate. */ export var EndItem = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) { var label = _ref.label, icon = _ref.icon, 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'], _ref$isListItem = _ref.isListItem, isListItem = _ref$isListItem === void 0 ? true : _ref$isListItem, shortcut = _ref.shortcut; var Wrapper = isListItem ? ListItem : Fragment; return /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(IconButton, { ref: forwardedRef, icon: icon, label: label, onClick: onClick, onMouseEnter: onMouseEnter, appearance: "subtle", isSelected: isSelected, isTooltipDisabled: false, testId: testId, interactionName: interactionName, "aria-controls": ariaControls, "aria-expanded": ariaExpanded, "aria-haspopup": ariaHasPopup // Only creating object when shortcut is provided , tooltip: shortcut ? { shortcut: shortcut } : undefined })); });