@atlaskit/navigation-system
Version:
The latest navigation system for Atlassian apps.
46 lines • 1.38 kB
JavaScript
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 const EndItem = /*#__PURE__*/forwardRef(({
label,
icon,
onClick,
onMouseEnter,
isSelected,
testId,
interactionName,
'aria-controls': ariaControls,
'aria-expanded': ariaExpanded,
'aria-haspopup': ariaHasPopup,
isListItem = true,
shortcut
}, forwardedRef) => {
const 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
} : undefined
}));
});