Media Query Props
INSTALL
yarn add mq-props
USAGE
mqProps(sizes: Array<MediaQuery: string>)(property: string)(value: string)
Basic
; // Set your media queriesconst SIZES = 'min-width: 320px' 'min-width: 480px' 'min-width: 768px'; // pass them to mq-propsconst sized = ; 'cyan' 'magenta' 'yellow' 'black'; /** * returns: * { * color: 'cyan', * '@media (min-width: 320px)': { * propertyToSet: 'magenta' * }, * '@media (min-width: 480px)': { * propertyToSet: 'yellow' * }, * '@media (min-width: 768px)': { * propertyToSet: 'black' * } * }; * **/
Skipping a value
; // Set your media queriesconst SIZES = 'min-width: 320px' 'min-width: 480px' 'min-width: 768px'; // pass them to mq-propsconst sized = ; 'cyan' null 'yellow' 'black'; /** * returns: * { * color: 'cyan', * '@media (min-width: 480px)': { * propertyToSet: 'yellow' * }, * '@media (min-width: 768px)': { * propertyToSet: 'black' * } * }; * **/