UNPKG

@atlaskit/page

Version:

A page layout organizes sections on a page using a grid and grid columns.

53 lines (50 loc) 1.74 kB
/* grid.tsx generated by @compiled/babel-plugin v0.39.1 */ import _defineProperty from "@babel/runtime/helpers/defineProperty"; import "./grid.compiled.css"; import * as React from 'react'; import { ax, ix } from "@compiled/react/runtime"; import { useContext } from 'react'; import { defaultLayout, spacingMapping } from './constants'; import { GridContext } from './grid-context'; var defaultGridColumnWidth = 80; /** * The number of available columns in each row. */ var varColumnsNum = '--ds-columns-num'; /** * The spacing (in `px`) between each column. */ var varGridSpacing = '--ds-grid-spacing'; var styles = { grid: "_19pkidpf _2hwx1wug _otyridpf _18u01wug _ca0qidpf _u5f3wx3y _n3tdidpf _19bvwx3y _1e0c1txw _kqswh2mm _4cvr1y6m _1n261g80", nestedGrid: "_19pkidpf _2hwx1un2 _otyridpf _18u01un2" }; var gridLayoutMapStyles = { fixed: "_p12fgkkb", fluid: "_p12f1osq" }; /** * __Grid__ * * A container for one or more `GridColumn`. * * This is the internal component, which relies on the context provided by the * grid wrapper. * * @internal */ export var Grid = function Grid(_ref) { var _ref$layout = _ref.layout, layout = _ref$layout === void 0 ? defaultLayout : _ref$layout, testId = _ref.testId, children = _ref.children; var _useContext = useContext(GridContext), isNested = _useContext.isNested, columns = _useContext.columns, spacing = _useContext.spacing; return /*#__PURE__*/React.createElement("div", { style: _defineProperty(_defineProperty({}, varColumnsNum, columns), varGridSpacing, "".concat(spacingMapping[spacing], "px")), "data-testid": testId, className: ax([styles.grid, gridLayoutMapStyles[layout], isNested && styles.nestedGrid]) }, children); };