-
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: primitive children prop mapping #191
Conversation
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.
Changes look good to me, but I'd want to confirm that we've never seen that 'value' prop used in a text before we release.
@@ -71,7 +71,7 @@ | |||
"position": { | |||
"value": "absolute" | |||
}, | |||
"value": { |
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.
I'm a bit concerned about this - as far as I understood it these complexTests came from a real export from studio ui - if they're publishing the value then we shouldn't be changing this behavior.
Could you confirm with @frimfram if this has been modified at all from the raw output of CLI?
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.
I would suggest that whenever we are "removing" something in a PR, that PR should contain new tests with "realistic" JSONs that get generated from Studio UI Figma import. That would make sure that we don't just work with assumptions and/or fake jsons that were created outside of Studio UI.
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.
This would be a breaking change I believe the current UI is not compatible with this. In my opinion this is a change that we should make before re:invent because we won't be able to make breaking changes easily after re:invent. I will check with the UI team to get consensus on the functionality.
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.
To add an example:
Text and Button would have different approaches to put text as a child.
Text:
{
"componentType": "Text",
"properties": {
"value": {
"value": "text"
}
}
}
<Text>text</Text>
Button:
{
"componentType": "Button",
"properties": {
"children": {
"value": "text"
}
}
}
<Button children="text"></Button>
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.
Yeah, definitely agreed that the change makes sense, and harrison and chris have verbally confirmed that the children thing is being used rather than value, but we should just confirm w/ Rene that we're okay with this change, since he brought it up during backlog refinement yesterday.
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.
Sounds good, waiting on response from René.
48bf59a
to
8ca61da
Compare
I've updated this PR with WIP primitive children prop mapping. |
c1668c0
to
622bf71
Compare
5a268a7
to
b1ebfbc
Compare
return Object.values(Primitive).includes(componentType as Primitive); | ||
} | ||
|
||
export const PrimitiveChildrenPropMapping: Partial<Record<Primitive, string>> = { |
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.
Got the ok on this list from René.
Looking into the failed integ test now. |
Remove special logic for Text
b1ebfbc
to
06eb67c
Compare
Existing Text prop
value
functionality is preserved for now. All existing Studio apps need to update Text propertyvalue
tolabel
, then Text propvalue
functionality can be removed.label
was chosen because it does not have any conflicts with existing primitive props.children
for primitives that will likely have scalars as children.Primitives
enum toPrimitive
to follow enum styleSee
packages/studio-ui-codegen-react/lib/react-component-with-children-renderer.ts
for mapping logic.