-
Notifications
You must be signed in to change notification settings - Fork 4.7k
BoxControl: stop using UnitControl's deprecated unit prop
#39511
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
Conversation
|
Size Change: +59 B (0%) Total Size: 1.16 MB
ℹ️ View Unchanged
|
andrewserong
left a comment
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 is testing nicely for me in the editor (e.g. padding controls on the group block, and for axial controls, padding controls on the button block) and in Storybook. It appears to behave exactly the same as on trunk as far as I can tell! 👍
The concatenated unit value appears to be present on trunk for 0 based values (e.g. 0px) so that doesn't appear to be different here, either.
LGTM! Since there's a fair bit going on in this component, it might be worth getting a second pair of eyes before landing the PR, just as a confidence check 🙂
Couldn't agree more. I actually spent more than I wanted on this refactor exactly because I didn't know the component very well and was afraid on introducing a regression. Let's wait for a second pair of eyes to review this |
| isLast={ last === side } | ||
| isOnly={ only === side } | ||
| value={ values[ side ] } | ||
| unit={ |
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.
For ease of review: the unit prop here was removed, and instead the parsing and potentially overriding of the unit is applied to the value prop
| isLast={ last === side } | ||
| isOnly={ only === side } | ||
| value={ side === 'vertical' ? values.top : values.left } | ||
| unit={ |
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.
For ease of review: the unit prop here was removed, and instead the parsing and potentially overriding of the unit is applied to the value prop
|
|
||
| // Set meaningful unit selection if no allValue and user has previously | ||
| // selected units without assigning values while controls were unlinked. | ||
| const allUnitFallback = ! allValue |
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.
For ease of review: the unit prop below was removed. As a consequence, the allUnitFallback variable was also removed. The logic used for computing allUnitFallback has been moved and "embedded" in the getAllValue utility function
mirka
left a comment
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 make sense to me, and the inline comments were helpful. Thanks!
| const allParsedQuantities = parsedQuantitiesAndUnits.map( | ||
| ( value ) => value[ 0 ] ?? '' | ||
| ); | ||
| const allUnits = parsedQuantitiesAndUnits.map( ( value ) => value[ 1 ] ); | ||
| const allParsedUnits = parsedQuantitiesAndUnits.map( |
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.
Verbosity FTW
…Press#39511) * Stop using `unit` prop in `AllInputControl` * Stop using `unit` prop in `AxialInputControls` * Stop using `unit` prop in `InputControls` * CHANGELOG
What?
Related to #39503 , this PR refactors the
BoxControlcomponent to avoid using the deprecatedunitprop from theUnitControlcomponent.Why?
The
unitprop is marked as deprecated, the component's docs recommend passing the unit directly through thevaluepropHow?
Refactor the code to pass the unit directly through the
valuepropTesting Instructions