How to use the css-in-js-utils/lib/assignStyle 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-extend / src / index.js View on Github external
function extendStyle(style: Object, extension: Object): void {
  // extend conditional style objects
  if (
    extension &&
    Object.prototype.hasOwnProperty.call(extension, 'condition')
  ) {
    if (extension.condition) {
      // eslint-disable-next-line no-use-before-define
      assignStyle(style, extend(extension.style))
    }
  } else {
    // extend basic style objects
    assignStyle(style, removeUndefined(extension))
  }
}
github robinweser / fela / packages / fela-plugin-extend / index.es2015.js View on Github external
function extendStyle(style, extension, extendPlugin) {
  // extend conditional style objects
  if (extension.hasOwnProperty('condition')) {
    if (extension.condition) {
      assignStyle(style, extendPlugin(extension.style));
    }
  } else {
    // extend basic style objects
    assignStyle(style, extension);
  }
}
github robinweser / fela / packages / fela-plugin-named-keys / src / index.js View on Github external
function resolveNamedKeys(style: Object, keys: Object) {
  for (const property in style) {
    const value = style[property]

    if (isPlainObject(value)) {
      const resolvedValue = resolveNamedKeys(value, keys)

      if (keys.hasOwnProperty(property)) {
        const resolvedKey = keys[property]
        if (style.hasOwnProperty(resolvedKey)) {
          style[resolvedKey] = assignStyle(style[resolvedKey], resolvedValue)
        } else {
          style[resolvedKey] = resolvedValue
        }

        // We clean the old keys as they're not used anymore
        delete style[property]
      }
    }
  }

  return style
}
github robinweser / fela / packages / fela-plugin-extend / src / index.js View on Github external
function extendStyle(style: Object, extension: Object): void {
  // extend conditional style objects
  if (
    extension &&
    Object.prototype.hasOwnProperty.call(extension, 'condition')
  ) {
    if (extension.condition) {
      // eslint-disable-next-line no-use-before-define
      assignStyle(style, extend(extension.style))
    }
  } else {
    // extend basic style objects
    assignStyle(style, removeUndefined(extension))
  }
}
github robinweser / fela / packages / fela-plugin-extend / index.es2015.js View on Github external
function extendStyle(style, extension, extendPlugin) {
  // extend conditional style objects
  if (extension.hasOwnProperty('condition')) {
    if (extension.condition) {
      assignStyle(style, extendPlugin(extension.style));
    }
  } else {
    // extend basic style objects
    assignStyle(style, extension);
  }
}
github robinweser / fela / packages / fela-plugin-custom-property / index.es2015.js View on Github external
function resolveCustomProperty(style, properties) {
  for (var property in style) {
    var value = style[property];

    if (properties.hasOwnProperty(property)) {
      assignStyle(style, properties[property](value));
      delete style[property];
    }

    if (isObject(value)) {
      style[property] = resolveCustomProperty(value, properties);
    }
  }

  return style;
}
github robinweser / fela / packages / fela-plugin-placeholder-prefixer / index.es2015.js View on Github external
function resolveCustomProperty(style, properties) {
  for (var property in style) {
    var value = style[property];

    if (properties.hasOwnProperty(property)) {
      assignStyle(style, properties[property](value));
      delete style[property];
    }

    if (isObject(value)) {
      style[property] = resolveCustomProperty(value, properties);
    }
  }

  return style;
}