Skip to content

Conversation

@jorgefilipecosta
Copy link
Member

Description

This pr updates the documentation of @wordpress/components/FontSizePicker.

The component was updated with additional props added and the structure of existing props changed but the updates to the docs were missing.

How has this been tested?

Just documentation updates. I checked the sample code works and does not contain linting error, by pasting it in an existing block.

@jorgefilipecosta jorgefilipecosta added [Type] Enhancement A suggestion for improvement. [Type] Developer Documentation Documentation for developers [Package] Components /packages/components labels Nov 2, 2018
onChange,
value,
withSlider,
withSlider = false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be part of this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ZebulanStanphill,
By default withSlider was already "falsy" but not explicitly. If we add an explicit false value, we can document that it is false by default. I think documenting this is helpful for the users, that is the reason this change was added here.

Copy link
Contributor

@chrisvanpatten chrisvanpatten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't want to block merging because my tweaks are minor and perfect is the enemy of good, but I have a few suggestions. Thanks for getting this documented 👍 🥇

### fontSizes

The current font size value. If a button value matches the font size value that button is pressed. RangeControl is rendered with this value.
An array of font size objects. The object should contain properties size and name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you also need to provide a "slug"? I might be wrong but I think it's expected in terms of generating CSS classes (although maybe that doesn't get passed into this version of the component?)

I'd also like to see an example here… happy to add that, if you want. Something simple like

{
    size: 12,
    name: "My Font Size",
    slug: "font-slug" // if needed
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I know we show it above, but being more explicit will be good for users who are newer to JS.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are totally right I missed the slug property and it is used to generate classes in the component. The situation was resolved. thank you for catching this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorgefilipecosta No prob! I also thought that it was possible we only used slug inside the editor version of this component so I'm glad I checked :)

@jorgefilipecosta jorgefilipecosta force-pushed the update/components-font-size-picker-docs branch 2 times, most recently from 48749cc to 968b046 Compare November 9, 2018 13:38
@jorgefilipecosta jorgefilipecosta force-pushed the update/components-font-size-picker-docs branch from 968b046 to 3facd94 Compare November 9, 2018 13:47
Copy link
Contributor

@chrisvanpatten chrisvanpatten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very very good, happy to see it land!

@jorgefilipecosta jorgefilipecosta merged commit e5dcd56 into master Nov 9, 2018
@jorgefilipecosta jorgefilipecosta deleted the update/components-font-size-picker-docs branch November 9, 2018 14:44
@jorgefilipecosta
Copy link
Member Author

Thank you for your review @chrisvanpatten!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Type] Developer Documentation Documentation for developers [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants