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

Support passing React.ReactElements for icons #4994

Merged
merged 9 commits into from
Oct 9, 2024
Merged

Conversation

camertron
Copy link
Collaborator

Closes https://github.com/github/primer/issues/3907

We accept React.FunctionComponent for a number of icon slots, but not a regular 'ol React.ReactElement. This PR updates several components to accept both, which should make Figma happier.

Changelog

New

Changed

Updated the following components to accept a React.ReactElement for icon slots:

  • AutocompleteMenuItem
  • AutocompleteMenu
  • SegmentedControlButton
  • SegmentedControlIconButton

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

This PR should not require any updates in production, as it is purely additive.

Merge checklist

Copy link

changeset-bot bot commented Sep 19, 2024

🦋 Changeset detected

Latest commit: 8a0777a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Sep 19, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 96.95 KB (+0.02% 🔺)
packages/react/dist/browser.umd.js 97.34 KB (+0.07% 🔺)

@github-actions github-actions bot temporarily deployed to storybook-preview-4994 September 19, 2024 23:30 Inactive
@camertron camertron marked this pull request as ready for review September 19, 2024 23:39
@camertron camertron requested a review from a team as a code owner September 19, 2024 23:39
Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! If you have the time, it'd also be great to:

  • Update stories to use the React.ReactElement format (this will be preferred over React.FC moving forward)
  • Add a test either as a type test or in Jest for the new type

Copy link
Contributor

github-actions bot commented Oct 8, 2024

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 8, 2024
@camertron
Copy link
Collaborator Author

camertron commented Oct 8, 2024

Hey @joshblack 👋 I added type tests, but I wasn't able to find any instances of our stories passing anything for visuals/icons other than React.ReactElements. That's probably because my React fu isn't as attuned as yours. Are there any specific examples you're thinking of?

@github-actions github-actions bot temporarily deployed to storybook-preview-4994 October 9, 2024 18:11 Inactive
@camertron camertron added this pull request to the merge queue Oct 9, 2024
Merged via the queue into main with commit be58fff Oct 9, 2024
43 checks passed
@camertron camertron deleted the support_icon_elements branch October 9, 2024 22:37
@primer primer bot mentioned this pull request Oct 9, 2024
@primer primer bot mentioned this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants