UNPKG

@kiwicom/orbit-components

Version:

Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.

27 lines (26 loc) 864 B
"use client"; import _extends from "@babel/runtime/helpers/esm/extends"; import * as React from "react"; import Grid from "../utils/Grid"; import { LAYOUT_SETTINGS } from "./consts"; const getChildrenProps = (type, key) => { if (LAYOUT_SETTINGS[type].layoutColumns && LAYOUT_SETTINGS[type].layoutColumns[key]) { return LAYOUT_SETTINGS[type].layoutColumns[key]; } return null; }; const Layout = ({ children, type, dataTest }) => /*#__PURE__*/React.createElement(Grid, _extends({}, LAYOUT_SETTINGS[type], { className: "px-md de:p-lg mx-auto my-0 box-border w-full py-0", dataTest: dataTest }), React.Children.map(children, (item, key) => { return /*#__PURE__*/React.cloneElement(item, { ...getChildrenProps(type, key.toString()), ...item.props }); })); export default Layout; export { default as LayoutColumn } from "./LayoutColumn";