UNPKG

@atlaskit/page

Version:

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

57 lines (54 loc) 1.58 kB
/* grid.tsx generated by @compiled/babel-plugin v0.39.1 */ 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'; const defaultGridColumnWidth = 80; /** * The number of available columns in each row. */ const varColumnsNum = '--ds-columns-num'; /** * The spacing (in `px`) between each column. */ const varGridSpacing = '--ds-grid-spacing'; const styles = { grid: "_19pkidpf _2hwx1wug _otyridpf _18u01wug _ca0qidpf _u5f3wx3y _n3tdidpf _19bvwx3y _1e0c1txw _kqswh2mm _4cvr1y6m _1n261g80", nestedGrid: "_19pkidpf _2hwx1un2 _otyridpf _18u01un2" }; const 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 const Grid = ({ layout = defaultLayout, testId, children }) => { const { isNested, columns, spacing } = useContext(GridContext); return /*#__PURE__*/React.createElement("div", { style: { [varColumnsNum]: columns, // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 [varGridSpacing]: `${spacingMapping[spacing]}px` }, "data-testid": testId, className: ax([styles.grid, gridLayoutMapStyles[layout], isNested && styles.nestedGrid]) }, children); };