UNPKG

@gravity-ui/uikit

Version:

Gravity UI base styling and components

38 lines (37 loc) 1.28 kB
'use client'; import { jsx as _jsx } from "react/jsx-runtime"; import { block } from "../../utils/cn.js"; import { useLayoutContext } from "../hooks/useLayoutContext.js"; import { makeCssMod } from "../utils/index.js"; import "./Col.css"; const b = block('col'); /** * How many columns of you 12-th column layout will take content. * Must be used as a child of `Row` component. * * By default component takes all available space. * If you wont to specify static size to all media queries use `s` prop. In mobile first layout grid is first passible value. * * ```tsx * <Col s="12">some content</Col> * ``` * --- * * Note: you can use this empty component for spacing: * * ```tsx * <Row> * <Col s="2" l="1">col 2</Col> * <Col /> * <Col s="2" l="1">col 2</Col> * </Row> * ``` * --- * Storybook - https://preview.gravity-ui.com/uikit/?path=/docs/layout--playground#col */ export const Col = ({ children, style, className, qa, ...media }) => { const { getClosestMediaProps } = useLayoutContext(); const sizeModValue = getClosestMediaProps(media); return (_jsx("div", { style: style, className: b({ size: sizeModValue ? makeCssMod(sizeModValue) : undefined }, className), "data-qa": qa, children: children })); }; //# sourceMappingURL=Col.js.map