@atlaskit/navigation-system
Version:
The latest navigation system for Atlassian apps.
65 lines (63 loc) • 2.46 kB
JavaScript
/* banner.tsx generated by @compiled/babel-plugin v3.0.2 */
import "./banner.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { useContext } from 'react';
import { fg } from '@atlaskit/platform-feature-flags/fg';
import { useSkipLinkInternal } from '../../context/skip-links/use-skip-link-internal';
import { bannerMountedVar, UNSAFE_bannerVar } from './constants';
import { DangerouslyHoistCssVarToDocumentRoot } from './dangerously-hoist-css-var-to-document-root';
import { HoistCssVarToLocalGrid } from './hoist-css-var-to-local-grid';
import { DangerouslyHoistSlotSizes } from './hoist-slot-sizes-context';
import { useLayoutId } from './use-layout-id';
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`.
*/
export 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 = useContext(DangerouslyHoistSlotSizes);
var id = 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
*/
useSkipLinkInternal({
id: id,
label: skipLinkLabel,
isHidden: height === 0 || fg('platform_dst_nav4_skip_link_a11y_1')
});
return /*#__PURE__*/React.createElement("div", {
id: id,
"data-layout-slot": true,
className: ax([styles.root, xcss]),
"data-testid": testId
}, /*#__PURE__*/React.createElement(HoistCssVarToLocalGrid, {
variableName: 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, {
variableName: UNSAFE_bannerVar,
value: height
})
// ------ END UNSAFE STYLES ------
, children);
}