UNPKG

curls

Version:

💪 Responsive, expressive UI primitives for React written with Style Hooks and Emotion

35 lines (31 loc) • 1.03 kB
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) } export 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 }