@atlaskit/navigation-system
Version:
The latest navigation system for Atlassian apps.
31 lines • 1.23 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
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 const IconButton = /*#__PURE__*/forwardRef(({
isTooltipDisabled,
shouldShowLabel,
...props
}, ref) => {
const 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
}));
});