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.

30 lines (28 loc) 1.05 kB
import { css } from "styled-components"; import { getJustify, getAlign, getDirection, getWrap, getGrow, getShrink } from "../../utils/layout"; import getWidth from "./getWidth"; import getDisplay from "./getDisplay"; import getBasis from "./getBasis"; import getSpacingToken from "../../common/getSpacingToken"; const getViewportFlexStyles = viewport => props => { const { flex, theme } = props; const { inline, direction, wrap, grow, shrink, basis, justify, align, spaceAfter } = props[viewport]; return css(["", ";width:", ";margin-bottom:", ";"], flex && css(["display:", ";flex-direction:", ";flex-wrap:", ";flex-grow:", ";flex-shrink:", ";flex-basis:", ";justify-content:", ";align-content:", ";align-items:", ";"], getDisplay(inline), getDirection(direction), getWrap(wrap), getGrow(grow), getShrink(shrink), getBasis(basis), getJustify(justify), getAlign(align), getAlign(align)), getWidth(inline), getSpacingToken({ spaceAfter, theme })); }; export default getViewportFlexStyles;