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.

31 lines 1.1 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]; const flexStyles = 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)({ theme }), getJustify(justify), getAlign(align), getAlign(align)); return css(["", ";width:", ";margin-bottom:", ";"], flexStyles, getWidth(inline), getSpacingToken({ spaceAfter, theme })); }; export default getViewportFlexStyles;