UNPKG

@atlaskit/navigation-system

Version:

The latest navigation system for Atlassian apps.

73 lines (70 loc) • 3.43 kB
/* banner.tsx generated by @compiled/babel-plugin v3.0.2 */ "use strict"; var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports.Banner = Banner; require("./banner.compiled.css"); var _react = _interopRequireWildcard(require("react")); var React = _react; var _runtime = require("@compiled/react/runtime"); var _fg = require("@atlaskit/platform-feature-flags/fg"); var _useSkipLinkInternal = require("../../context/skip-links/use-skip-link-internal"); var _constants = require("./constants"); var _dangerouslyHoistCssVarToDocumentRoot = require("./dangerously-hoist-css-var-to-document-root"); var _hoistCssVarToLocalGrid = require("./hoist-css-var-to-local-grid"); var _hoistSlotSizesContext = require("./hoist-slot-sizes-context"); var _useLayoutId = require("./use-layout-id"); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } var styles = { root: "_nd5ldkfm _1reo15vq _18m915vq _4t3iutvi _152tidpf _kqsw1if8 _1pbyegat" }; /** * The banner layout area. It will always be displayed at the top of the screen. * * Should be used to render a `Banner` component from `@atlaskit/banner`. */ function Banner(_ref) { var children = _ref.children, xcss = _ref.xcss, _ref$height = _ref.height, height = _ref$height === void 0 ? 48 : _ref$height, _ref$skipLinkLabel = _ref.skipLinkLabel, skipLinkLabel = _ref$skipLinkLabel === void 0 ? 'Banner' : _ref$skipLinkLabel, testId = _ref.testId, providedId = _ref.id; var dangerouslyHoistSlotSizes = (0, _react.useContext)(_hoistSlotSizesContext.DangerouslyHoistSlotSizes); var id = (0, _useLayoutId.useLayoutId)({ providedId: providedId }); /** * Don't show the skip link if the slot has 0 height. * * TODO: when cleaning up 'platform_dst_nav4_skip_link_a11y_1' remove this call entirely */ (0, _useSkipLinkInternal.useSkipLinkInternal)({ id: id, label: skipLinkLabel, isHidden: height === 0 || (0, _fg.fg)('platform_dst_nav4_skip_link_a11y_1') }); return /*#__PURE__*/React.createElement("div", { id: id, "data-layout-slot": true, className: (0, _runtime.ax)([styles.root, xcss]), "data-testid": testId }, /*#__PURE__*/React.createElement(_hoistCssVarToLocalGrid.HoistCssVarToLocalGrid, { variableName: _constants.bannerMountedVar, value: height }), dangerouslyHoistSlotSizes && /*#__PURE__*/ // ------ START UNSAFE STYLES ------ // These styles are only needed for the UNSAFE legacy use case for Jira + Confluence. // When they aren't needed anymore we can delete them wholesale. React.createElement(_dangerouslyHoistCssVarToDocumentRoot.DangerouslyHoistCssVarToDocumentRoot, { variableName: _constants.UNSAFE_bannerVar, value: height }) // ------ END UNSAFE STYLES ------ , children); }