UNPKG

@atlaskit/navigation-system

Version:

The latest navigation system for Atlassian apps.

40 lines (37 loc) • 1.4 kB
/* top-nav-start.tsx generated by @compiled/babel-plugin v3.0.2 */ import "./top-nav-start.compiled.css"; import { ax, ix } from "@compiled/react/runtime"; import React, { useContext, useEffect, useRef } from 'react'; import { fg } from '@atlaskit/platform-feature-flags/fg'; import { TopNavStartAttachRef } from '../../../context/top-nav-start/top-nav-start-attach-ref'; /** * Styles for the TopNavStart element. */ const innerStyles = { root: "_zulp1b66 _yyhykb7n _4t3i1osq _4cvr1h6o _1e0c1txw", container: "_1bsb14ik _1ul91wqq _vchhusvi _gltexl30 _15ritp0n", viewport: "_glte1ris _15rip2n4 _1gs5usvi" }; /** * __TopNavStart__ * * Wrapper for the top navigation actions on the inline-start (left) side of the top navigation. */ export function TopNavStart({ children, testId, sideNavToggleButton }) { const ref = useContext(TopNavStartAttachRef); const elementRef = useRef(null); // FIXME: unsafe pattern with Suspense, should use callback ref / store in state // Should handle the underlying HTMLElement changing without a remount useEffect(() => { ref(elementRef.current); }, [elementRef, ref]); return /*#__PURE__*/React.createElement("div", { ref: elementRef, "data-testid": testId, className: ax([innerStyles.root, fg('platform-dst-chat-panel-layout') ? innerStyles.container : innerStyles.viewport]) }, sideNavToggleButton, children); }