styled-components
Version:
Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
20 lines (17 loc) • 578 B
JavaScript
// @flow
import interleave from '../utils/interleave'
import isPlainObject from '../utils/isPlainObject'
import { EMPTY_ARRAY } from '../utils/empties'
import flatten from '../utils/flatten'
import type { Interpolation, RuleSet, Styles } from '../types'
export default (
styles: Styles,
...interpolations: Array<Interpolation>
): RuleSet => {
if (typeof styles === 'function' || isPlainObject(styles)) {
// $FlowFixMe
return flatten(interleave(EMPTY_ARRAY, [styles, ...interpolations]))
}
// $FlowFixMe
return flatten(interleave(styles, interpolations))
}