UNPKG

@atlaskit/navigation-system

Version:

The latest navigation system for Atlassian apps.

65 lines (63 loc) • 2.32 kB
/* 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'; const 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({ children, xcss, // 48px has been chosen to align with the height of the Banner component from `@atlaskit/banner`. height = 48, skipLinkLabel = 'Banner', testId, id: providedId }) { const dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes); const id = useLayoutId({ 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, 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); }