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.

34 lines (33 loc) 992 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 }) => { // Removes unwanted props from Grid const { layoutColumns: _, ...props } = LAYOUT_SETTINGS[type]; return /*#__PURE__*/React.createElement(Grid, _extends({}, props, { className: "px-400 de:p-600 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";