-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Button Block: Update to use color support utils to retrieve classes and styles #30870
Button Block: Update to use color support utils to retrieve classes and styles #30870
Conversation
Size Change: -307 B (0%) Total Size: 1.46 MB
ℹ️ View Unchanged
|
It looks like mobile still uses the @geriux we're introducing a new utility for retrieving classes and inline styles at #30869 Could any of you at mobile check that utility and remove |
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've noticed that there was a test failure due to removing packages/block-library/src/button/color-props.js
that mobile still uses it so I reverted the removal of that file.
Other than that this is ready. Let's wait for tests to pass to merge this, in case I missed something.
Thanks, I saw that this morning. My mistake, I missed updating the native edit component. I've just pushed a commit that updates the button edit component for mobile. As it is a class component the hook utility couldn't be used cleanly in place of the original function from In addition, the native button edit component was still relying on the withColors hook and therefore attributes that wouldn't match those provided by the colors support the button block opts into via the block.json. I believe the last commit brings the native component up-to-date in that respect. With all the above changes, I deleted the |
Hi @aaronrobertshaw I added the |
Thanks @jd-alexander, I'll keep that label in mind in future. |
Hey @aaronrobertshaw 👋 I'll run some sanity checks, thanks for updating the native files 🎉 |
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.
LGTM!
The existing color-props.js code has been reworked into a utility exported from the block support hooks to facilitate its reuse across blocks.
This brings the native button component up-to-date after the switch to use the colors block support feature. It now also uses the color utilities for determining color styles and allows for the color-props.js file to be deleted.
65c8975
to
b521bb0
Compare
Description
This updates the button block to use a new utility exported from the block support hooks to retrieve color related CSS classes and inline styles which are then applied to inner elements.
The original
color-props.js
function has been re-worked into the new utilities mentioned above.How has this been tested?
Manually and via
npm run test-unit
to ensure fixture tests still show the correct classes and styles being applied.Test Instructions
npm run test-unit
and confirm no failures.Types of changes
Refactor. No new features, no breaking changes.
Checklist:
*.native.js
files for terms that need renaming or removal).