@gravity-ui/uikit
Version:
Gravity UI base styling and components
56 lines (55 loc) • 1.59 kB
JavaScript
'use client';
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Row = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const cn_1 = require("../../utils/cn.js");
const useLayoutContext_1 = require("../hooks/useLayoutContext.js");
const utils_1 = require("../utils/index.js");
require("./Row.css");
const b = (0, cn_1.block)('row');
/**
* Defines the margins between columns (`<Col />`).
*
* Required to use with `<Col />` component
*
* ```tsx
* import {Row, Col} from '@gravity-ui/uikit';
*
* <Row space="5">
* <Col>col</Col>
* <Col>col</Col>
* </Row>
* ```
* ---
* Storybook - https://preview.gravity-ui.com/uikit/?path=/docs/layout--playground#row
*/
const Row = ({ children, style, className, space, spaceRow, qa }) => {
const { getClosestMediaProps } = (0, useLayoutContext_1.useLayoutContext)();
let s;
let sr;
if (typeof space === 'object') {
const res = getClosestMediaProps(space);
if (res) {
s = (0, utils_1.makeCssMod)(res);
}
}
else if (space) {
s = (0, utils_1.makeCssMod)(space);
}
if (typeof spaceRow === 'object') {
const res = getClosestMediaProps(spaceRow);
if (res) {
sr = (0, utils_1.makeCssMod)(res);
}
}
else if (spaceRow) {
sr = String(spaceRow);
}
return ((0, jsx_runtime_1.jsx)("div", { style: style, className: b({
s,
sr,
}, className), "data-qa": qa, children: children }));
};
exports.Row = Row;
//# sourceMappingURL=Row.js.map