Skip to content
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

Merged
merged 1 commit into from
May 9, 2018

Conversation

jorgefilipecosta
Copy link
Member

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.

Copy link
Member

@gziolo gziolo left a 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`;
Copy link
Member

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?

Copy link
Member Author

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.
@jorgefilipecosta
Copy link
Member Author

Thank you for the review @gziolo, the readme was added before the merge 👍

@mtias mtias deleted the add/font-size-picker branch May 17, 2018 16:45
@mtias mtias added this to the 2.9 milestone May 17, 2018
@rchipka
Copy link

rchipka commented May 23, 2018

This is exactly the kind of thing I'm referencing in #6651

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants