@atlaskit/navigation-system
Version:
The latest navigation system for Atlassian apps.
39 lines (36 loc) • 1.46 kB
JavaScript
/* 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.
*/
var 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(_ref) {
var children = _ref.children,
testId = _ref.testId,
sideNavToggleButton = _ref.sideNavToggleButton;
var ref = useContext(TopNavStartAttachRef);
var 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(function () {
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);
}