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.

32 lines (31 loc) 1.03 kB
"use strict"; exports.__esModule = true; exports.getBreakpointWidth = exports.default = exports.TOKEN = void 0; var _styledComponents = require("styled-components"); var _consts = require("./consts"); const TOKEN = { mediumMobile: "widthBreakpointMediumMobile", largeMobile: "widthBreakpointLargeMobile", tablet: "widthBreakpointTablet", desktop: "widthBreakpointDesktop", largeDesktop: "widthBreakpointLargeDesktop" }; exports.TOKEN = TOKEN; const getBreakpointWidth = (name, theme, pure) => { return pure ? theme.orbit[TOKEN[name]] : `(min-width: ${theme.orbit[TOKEN[name]]}px)`; }; exports.getBreakpointWidth = getBreakpointWidth; const mediaQueries = Object.values(_consts.QUERIES).reduce((acc, device) => { acc[device] = style => (0, _styledComponents.css)(["@media ", "{", ";}"], ({ theme }) => getBreakpointWidth(device, theme), style); return acc; }, { mediumMobile: {}, largeMobile: {}, tablet: {}, desktop: {}, largeDesktop: {} }); var _default = mediaQueries; exports.default = _default;