UNPKG

@atlaskit/navigation-system

Version:

The latest navigation system for Atlassian apps.

27 lines • 982 B
import _extends from "@babel/runtime/helpers/extends"; import React, { forwardRef } from 'react'; import { useIsCompactTopNav } from '../page-layout/top-nav/use-is-compact-top-nav'; /** * An explicit responsive action: icon-only at xs/xxs, icon and label at sm and above. * TopNav provides container measurements behind platform-dst-chat-panel-layout. * Server markup uses an accessible icon-only fallback until client measurement. * With the gate off or outside TopNav, it uses text. The button element is preserved. */ export const ResponsiveButton = /*#__PURE__*/forwardRef(({ iconButton: IconButtonComponent, icon, label, tooltip, isTooltipDisabled = false, ...props }, ref) => { const isCompact = useIsCompactTopNav(); return /*#__PURE__*/React.createElement(IconButtonComponent, _extends({}, props, { ref: ref, icon: icon, label: label, shouldShowLabel: !isCompact, isTooltipDisabled: isTooltipDisabled, tooltip: tooltip })); });