@wezom/toolkit-css-in-js
Version:
Useful tools for working with CSS-in-JS
24 lines (20 loc) • 682 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
/**
* Setting border values a little more declarative
* @example
* jssBorder(2); // => '2px solid'
* jssBorder('0.25rem'); // => '0.25rem solid'
* jssBorder(3, 'double'); // => '3px double'
* // instead of concat `1px solid ${myColorVar}`
* jssBorder(1, 'solid', myColorVar); // => '1px solid #f00'
*/
function jssBorder(width, style, color) {
if (style === void 0) {
style = 'solid';
}
var w = typeof width === 'number' ? width + 'px' : width;
var c = typeof color === 'string' && color.length > 0 ? ' ' + color : '';
return w + ' ' + (style + c);
}
exports.jssBorder = jssBorder;