How to use the @carbon/icon-helpers.defaultAttributes.style function in @carbon/icon-helpers

To help you get started, we’ve selected a few @carbon/icon-helpers 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 carbon-design-system / carbon / packages / icons-react / src / createFromInfo.js View on Github external
};
const prettierOptions = {
  parser: 'babel',
  printWidth: 80,
  singleQuote: true,
  trailingComma: 'es5',
  proseWrap: 'always',
};

const MODULE_IMPORTS = `
import { getAttributes } from '@carbon/icon-helpers';
import PropTypes from 'prop-types';
import React from 'react';

const defaultStyle = ${JSON.stringify(
  transformStyleIntoObject(defaultAttributes.style)
)};
`;

function createEntrypointFromMeta(meta) {
  const components = meta.map(info => {
    const source = createComponentFromInfo(info);
    return `export ${source}`;
  });
  const source = `${MODULE_IMPORTS}
${components.join('\n')}`;

  return babel.transformSync(source, babelOptions);
}

function createModuleFromInfo(info) {
  const source = `

@carbon/icon-helpers

Helpers used alongside icons for digital and software products using the Carbon Design System

Apache-2.0
Latest version published 29 days ago

Package Health Score

98 / 100
Full package analysis