How to use the @xstyled/util.flatten function in @xstyled/util

To help you get started, we’ve selected a few @xstyled/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github smooth-code / xstyled / packages / emotion / src / cx.js View on Github external
return theme => {
    const p = { theme }

    function parseStyle(style) {
      if (typeof style === 'object') {
        style = css(style)
      }
      return cascade(style, p)
    }

    if (Array.isArray(styles)) {
      return flatten(styles).map(parseStyle)
    }

    return parseStyle(styles)
  }
}