UNPKG

@atlaskit/page-layout

Version:

A collection of components which let you compose an application's page layout.

52 lines (50 loc) 1.87 kB
import _defineProperty from "@babel/runtime/helpers/defineProperty"; /** * @jsxRuntime classic * @jsx jsx */ import { useEffect } from 'react'; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766 import { jsx } from '@emotion/react'; import { VAR_LEFT_SIDEBAR_WIDTH } from '../../common/constants'; import { resolveDimension } from '../../common/utils'; import { publishGridState, useSkipLink } from '../../controllers'; import LeftSidebarInner from './internal/left-sidebar-inner'; import LeftSidebarOuter from './internal/left-sidebar-outer'; import SlotDimensions from './slot-dimensions'; /** * __Left sidebar without resize__ * * Provides a slot for a left sidebar without resize within the PageLayout. * * - [Examples](https://atlassian.design/components/page-layout/examples) * - [Code](https://atlassian.design/components/page-layout/code) */ var LeftSidebarWithoutResize = function LeftSidebarWithoutResize(props) { var children = props.children, id = props.id, width = props.width, isFixed = props.isFixed, shouldPersistWidth = props.shouldPersistWidth, testId = props.testId, skipLinkTitle = props.skipLinkTitle; var leftSidebarWidth = resolveDimension(VAR_LEFT_SIDEBAR_WIDTH, width, shouldPersistWidth); useEffect(function () { publishGridState(_defineProperty({}, VAR_LEFT_SIDEBAR_WIDTH, leftSidebarWidth)); return function () { publishGridState(_defineProperty({}, VAR_LEFT_SIDEBAR_WIDTH, 0)); }; }, [leftSidebarWidth]); useSkipLink(id, skipLinkTitle); return jsx(LeftSidebarOuter, { id: id, testId: testId, isFixed: isFixed }, jsx(SlotDimensions, { variableName: VAR_LEFT_SIDEBAR_WIDTH, value: leftSidebarWidth }), jsx(LeftSidebarInner, { isFixed: isFixed }, children)); }; export default LeftSidebarWithoutResize;