@atlaskit/navigation-system
Version:
The latest navigation system for Atlassian apps.
32 lines • 1.47 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["isTooltipDisabled", "shouldShowLabel"];
import React, { forwardRef } from 'react';
import AkIconButton from '@atlaskit/button/icon/button';
import { fg } from '@atlaskit/platform-feature-flags/fg';
import { useHasCustomTheme } from './has-custom-theme-context';
import { ResponsiveIconButton } from './responsive-icon-button';
import { ThemedIconButton } from './themed-icon-button';
export var IconButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
var isTooltipDisabled = _ref.isTooltipDisabled,
shouldShowLabel = _ref.shouldShowLabel,
props = _objectWithoutProperties(_ref, _excluded);
var hasCustomTheme = useHasCustomTheme();
if (shouldShowLabel !== undefined) {
return /*#__PURE__*/React.createElement(ResponsiveIconButton, _extends({}, props, {
ref: ref,
shouldShowLabel: shouldShowLabel,
isTooltipDisabled: isTooltipDisabled
}));
}
// Preserve legacy custom-theme behavior outside the chat-panel rollout.
return hasCustomTheme ? /*#__PURE__*/React.createElement(ThemedIconButton, _extends({
ref: ref
}, props, {
isTooltipDisabled: fg('platform-dst-chat-panel-layout') ? isTooltipDisabled : undefined
})) : /*#__PURE__*/React.createElement(AkIconButton, _extends({
ref: ref
}, props, {
isTooltipDisabled: isTooltipDisabled
}));
});