-
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
Add FontSizePicker component and refactor paragraph block to use it. #6618
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.
Code wise it looks good. I had one question where I wasn’t sure why this check was removed.
It would be great to add Readme file to the extracted component to make it easier to use it.
I haven’t tested myself ...
@@ -366,7 +351,7 @@ export const settings = { | |||
|
|||
const textClass = getColorClass( 'color', textColor ); | |||
const backgroundClass = getColorClass( 'background-color', backgroundColor ); | |||
const fontSizeClass = fontSize && FONT_SIZES[ fontSize ] && `is-${ fontSize }-text`; | |||
const fontSizeClass = fontSize && `is-${ fontSize }-text`; |
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.
Is it safe to remove this check?
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.
Yes, it is safe to remove this check. And I think, we should remove it. If we have set of font sizes now, and later we change the set we should probably keep using the same classes as before we should not remove the class just because we changed the set of FONT_SIZES. This will be changed again in #6628 when this logic is abstracted and removed from the paragraph.
This change makes font size UI generic and allows other blocks to take advantage of the same UI used in the paragraph. Other changes will follow that will abstract other font size logic from paragraph (not just the UI). Themes will also be able to configure the font sizes. The future changes will use this work.
cfda02b
to
57a5512
Compare
Thank you for the review @gziolo, the readme was added before the merge 👍 |
This is exactly the kind of thing I'm referencing in #6651 |
This change makes font size UI generic and allows other blocks to take advantage of the same UI used in the paragraph.
Other changes will follow that will abstract other font size logic from paragraph (not just the UI).
Themes will also be able to configure the font sizes.
This PR is the first in a series of PR's that implement the required changes.
Addresses part of #5714.
This PR is just a refactor no noticeable changes are expected.
How has this been tested?
Verify the font size changer in the paragraph continues to work exactly as before.