UNPKG

@shopgate/engage

Version:
8 lines 1.04 kB
import{parser}from"./breakpoints";var comparators={'>=':function _(from){return"@media (min-width: ".concat(from,"px)");},'>':function _(from,to){return"@media (min-width: ".concat(to,"px)");},'<':function _(from){return"@media (max-width: ".concat(from+1,"px)");},'<=':function _(from,to){return"@media (max-width: ".concat(to-1,"px)");},'':function _(from,to){return"@media (min-width: ".concat(from,"px) and (max-width: ").concat(to,"px)");}};/** * Generates a media query for different breakpoints and platform. * @param {string} breakpoint Breakpoint rule. * @param {Object} params Parameters needed to generation. * @returns {string} */export var responsiveMediaQuery=function responsiveMediaQuery(breakpoint){var params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var parsed=parser(comparators,breakpoint,params);// Return media query that never evaluates for now. if(!parsed){return'@media (height: 0)';}// Return media query that evaluates always. if(parsed===true){return'@media (min-height: 0)';}return parsed;};