curls
Version:
💪 Responsive, expressive UI primitives for React written with Style Hooks and Emotion
42 lines (35 loc) • 1.12 kB
JavaScript
exports.__esModule = true
exports.default = void 0
function _extends() {
_extends =
Object.assign ||
function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i]
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key]
}
}
}
return target
}
return _extends.apply(this, arguments)
}
var _default = (props, defaultStyles) => {
const defaultStylesIsArray = Array.isArray(defaultStyles)
if (Array.isArray(props.css)) {
if (defaultStylesIsArray) props.css.push.apply(props.css, defaultStyles)
else props.css.push(defaultStyles)
} else if (typeof props.css === 'object' && props.css !== null) {
props = _extends({}, props)
if (defaultStylesIsArray) props.css = [props.css].concat(defaultStyles)
else props.css = [props.css, defaultStyles]
} else {
props = _extends({}, props)
props.css = defaultStylesIsArray ? defaultStyles.slice(0) : [defaultStyles]
}
return props
}
exports.default = _default