How to use the css-in-js-utils/lib/isUnitlessProperty function in css-in-js-utils

To help you get started, we’ve selected a few css-in-js-utils 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 robinweser / fela / packages / fela-plugin-unit / src / index.js View on Github external
function addUnit(
  style: Object,
  defaultUnit: string,
  propertyMap: Object
): Object {
  for (const property in style) {
    if (!isUnitlessProperty(property)) {
      const cssValue = style[property]
      const propertyUnit = propertyMap[property] || defaultUnit

      if (isPlainObject(cssValue)) {
        style[property] = addUnit(cssValue, defaultUnit, propertyMap)
      } else if (Array.isArray(cssValue)) {
        style[property] = cssValue.map(val =>
          addUnitIfNeeded(property, val, propertyUnit)
        )
      } else {
        style[property] = addUnitIfNeeded(property, cssValue, propertyUnit)
      }
    }
  }

  return style
github robinweser / fela / modules / plugins / unit.js View on Github external
function addUnit(
  style: Object,
  defaultUnit: string,
  propertyMap: Object
): Object {
  for (const property in style) {
    if (!isUnitlessProperty(property)) {
      const cssValue = style[property]
      const propertyUnit = propertyMap[property] || defaultUnit

      if (isObject(cssValue)) {
        style[property] = addUnit(cssValue, defaultUnit, propertyMap)
      } else if (Array.isArray(cssValue)) {
        style[property] = cssValue.map(val =>
          addUnitIfNeeded(property, val, propertyUnit))
      } else {
        style[property] = addUnitIfNeeded(property, cssValue, propertyUnit)
      }
    }
  }

  return style
}