How to use the fela-utils.extractPassThroughProps function in fela-utils

To help you get started, we’ve selected a few fela-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 cloudflare / cf-ui / packages / cf-style-container / src / createComponent.js View on Github external
if (!theme) {
        throw new Error(
          "createComponent() can't render styles without the theme in the context. Wrap the root of your app with ."
        );
      }

      // compose passThrough props from arrays or functions
      const resolvedPassThrough = [
        ...resolvePassThrough(passThroughProps, ruleProps)
      ];

      if (ruleProps.className) {
        console.warn(`You cannot restyle Fela component ${componentName}`);
      }

      const componentProps = extractPassThroughProps(
        resolvedPassThrough,
        ruleProps
      );

      ruleProps.theme = theme || {};

      if (ruleProps.style) {
        componentProps.style = ruleProps.style;
      }

      componentProps.className = renderer.renderRule(rule, ruleProps);

      if (ruleProps.id) {
        componentProps.id = ruleProps.id;
      }