Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create codemod for migrating teams to new icons API #8516

Closed
joshblack opened this issue Apr 27, 2021 · 0 comments · Fixed by #8517
Closed

Create codemod for migrating teams to new icons API #8516

joshblack opened this issue Apr 27, 2021 · 0 comments · Fixed by #8517
Assignees

Comments

@joshblack
Copy link
Contributor

As part of #8139, we updated the signature of our icon components to now use a size prop. This issue is for creating a codemod to automatically update most examples of usage through a codemod. This should include updating the following usage patterns:

import React from 'react';
import { Add32, Bee24 as bee, Caret20, DownArrow16 } from '@carbon/icons-react';

const types = {
  add: Add32,
  bee: Bee24,
  ref,
  test: (props) => React.createElement(bee, {
    ref,
    size: 24,
    ...props,
  }),
};

function RendersIconDirectly() {
  return (
    <>
      <Add32 />
      <Bee24 />
      <Caret20 />
      <DownArrow16 />
    </>
  );
}

function RendersIconWithProps(props) {
  return (
    <>
      <Add32 aria-label="test" {...props} />
      <Bee24 aria-label="test" {...props} />
      <Caret20 aria-label="test" {...props} />
      <DownArrow16 aria-label="test" {...props} />
    </>
  );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant