primer / brand

React components and Primitives for GitHub marketing websites
https://primer.style/brand
MIT License
74 stars 33 forks source link

Export `Icon` from the package #827

Open rfearing opened 6 days ago

rfearing commented 6 days ago

Icon was released in release 0.42.0 but not exported, so it can't be used. It just needs to be exported from packages/react/src/index.ts I believe

joshfarrant commented 5 days ago

Hi @rfearing! 👋 Thanks for raising this.

When we introduced the component we made a conscious decision to keep it as an internal component for now. Currently, it's accessible through Card.Icon component and Bento.Content[leadingVisual] prop since these were the primary use cases we had in mind.

If you have specific use cases where you need Icon as a standalone component just let me know the specifics and we can reassess the decision 🙂

rfearing commented 5 days ago

@joshfarrant I think either I'm missing something obvious, or there was an oversight.

How do I put the Icon into the Bento.Content[leadingVisual] prop if Icon is never exported? In the storybook story for Bento, it is utilized as a relative import. I can't do that via an npm package.

I believe either the Icon component would need to be exported or a Bento.Icon created, right?

joshfarrant commented 1 day ago

Ah, you're absolutely right @rfearing, thank you for spotting this. It is indeed an oversight on my part!

@rezrah Are you happy for Icon to be exported as a public component? An alternative could be to create a Bento.Icon component which reexports Icon (in the same way we do in Card) which could then be used inside the leadingVisual prop. wdyt?