-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: add built-in iconset #219
Conversation
Amplify UI Change: aws-amplify/amplify-ui#696 (review) |
@@ -56,6 +58,8 @@ enum Primitive { | |||
|
|||
export default Primitive; | |||
|
|||
export const iconset = Object.keys(AmplifyUI).filter((name) => name.match(/^Icon\w/)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning! I've recommended we remove icons (https://github.com/aws-amplify/amplify-ui/discussions/480#discussioncomment-1438384) and instead have 1st class support for 3rd party icon libraries like @heroicons/react
, react-icons
, etc.
This has been a long-time coming, but this change hasn't landed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a feature complete perspective for ui codegen we need the ui API locked down today, with no breaking changes coming down the pipe. Is it possible to release icons under a new major version (3.x.x) once that's been agreed and implemented?
@hvergara for viz.
@@ -318,7 +318,7 @@ export abstract class ReactStudioTemplateRenderer extends StudioTemplateRenderer | |||
const propsType = this.getPropsTypeName(component); | |||
|
|||
const componentIsPrimitive = isPrimitive(component.componentType); | |||
if (componentIsPrimitive) { | |||
if (componentIsPrimitive || iconset.includes(component.componentType)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you use it in a few place, could you just extract this fn to like 'componentIsIcon'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
5708e6b
to
f196106
Compare
Added |
f196106
to
b876185
Compare
b876185
to
3203250
Compare
Dependent on aws-amplify/amplify-ui#709 |
3203250
to
6199a72
Compare
8c801e2
to
d5363f8
Compare
d5363f8
to
0de6cfa
Compare
This change uses a version of amplify-ui that is from 11/12. Do not merge until version has propagated to npmpm (~ 11/15)
Add support for built-in iconset codegen. https://ui.docs.amplify.aws/components/icon?platform=react#built-in-iconset
This change will fail with the following error until an update is made to Amplify UI.
I determined this was because the ESM version of the Amplify UI distribution was being loaded rather than the CommonJS version.
https://github.com/aws-amplify/amplify-ui/blob/main/packages/react/package.json#L4-L10
Changing the
exports
from the link above to the following will allow use to force use the CommonJS version with arequire
import.