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.

38 lines (37 loc) 1.23 kB
"use client"; import * as React from "react"; import styled, { css } from "styled-components"; import defaultTheme from "../../defaultTheme"; import { DEVICES } from "../../utils/mediaQuery/consts"; import mq from "../../utils/mediaQuery"; const StyledColumn = styled.div.withConfig({ displayName: "LayoutColumn__StyledColumn", componentId: "sc-aa57pk-0" })(["", ""], ({ spanEntireRow, hideOn }) => css(["", ";", ";"], Boolean(hideOn) && hideOn.length > 0 && Object.values(DEVICES).map(viewport => viewport in mq ? css(["", ";"], mq[viewport](css(["display:", ";"], hideOn.includes(viewport) && "none"))) : // "smallMobile" is not media query so we need to check it explicitly viewport === "smallMobile" && hideOn.includes(viewport) && css(["display:none;"])), spanEntireRow && css(["grid-column:1 / -1;"]))); StyledColumn.defaultProps = { theme: defaultTheme }; const LayoutColumn = ({ children, hideOn = [], as = "div", spanEntireRow, dataTest }) => { return ( /*#__PURE__*/ /* @ts-expect-error: as */ React.createElement(StyledColumn, { "data-test": dataTest, hideOn: hideOn, as: as, spanEntireRow: spanEntireRow }, children) ); }; export default LayoutColumn;