How to use the @xstyled/util.merge 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 / system / src / style.js View on Github external
function getStyle(props) {
    const styles = {}
    for (const key in props) {
      const generator = generatorsByProp[key]
      if (generator) {
        const style = generator.meta.getStyle(props)
        merge(styles, style)
      }
    }
    return styles
  }
github smooth-code / xstyled / packages / system / src / style.js View on Github external
export function reduceBreakpoints(props, values, getStyle = identity, cache) {
  const medias = cache ? getCachedMedias(props, cache) : getMedias(props)
  let styles = {}
  for (const breakpoint in values) {
    const style = getStyle(values[breakpoint])
    if (style === null) continue
    const media = medias[breakpoint]
    if (media === null) {
      styles = merge(styles, style)
    } else {
      styles[media] = styles[media] ? assign(styles[media], style) : style
    }
  }
  return styles
}