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

Handbook: Add dedicated Block Styles page under Block API directory #31055

Merged
merged 9 commits into from
May 10, 2021

Conversation

DaisyOlsen
Copy link
Contributor

@DaisyOlsen DaisyOlsen commented Apr 21, 2021

Description

Move Block Styles documentation to dedicated page under Block API section of Handbook

How has this been tested?

Documentation. Confirm links and names work as expected

Types of changes

Docs.

Closes #31054


The example above registers a block style named `fancy-quote` to the `core/quote` block. When the user selects this block style from the styles selector, an `is-style-fancy-quote` className will be added to the block's wrapper.

By adding `isDefault: true` you can mark the registered block style as the one that is recognized as active when no custom class name is provided. It also means that there will be no custom class name added to the HTML output for the style that is marked as default.
Copy link
Contributor

@carolinan carolinan Apr 22, 2021

Choose a reason for hiding this comment

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

no custom class name added to the HTML output for the style that is marked as default.
Please help confirm that this is correct. When there are custom styles available, and I select the default style,
I am seeing this CSS class both in the editor and front: is-style-default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I'll do some digging to confirm that this is accurate.

- `name`: The identifier of the style used to compute a CSS class.
- `label`: A human-readable label for the style.

Besides the two mandatory properties, the styles properties array should also include an `inline_style` or a `style_handle` property:
Copy link
Contributor

Choose a reason for hiding this comment

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

These are optional.
It is also possible to add the styles in any stylesheet that is already enqueued (enqueued, not only registered) in the editor or front, or both. Even without the style handle.

I think it would be a good idea to add a paragraph about the naming convention for the CSS class, even if it is already mentioned that it is "The identifier of the style used to compute a CSS class", an example would help.
-If the name of the style is prefix-box-shadow the CSS class to use is: is-style-prefix-box-shadow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR is mostly intended to establish the dedicated page for Block Styles under the Block API section instead of being rolled into the Block Filters page where it is currently. If my Block Patterns Page PR is merged I'd like to model this page in a similar way and expand the descriptions further.

@gziolo gziolo added [Type] Developer Documentation Documentation for developers [Feature] Block API API that allows to express the block paradigm. labels Apr 22, 2021
Daisy Olsen and others added 2 commits April 22, 2021 07:41
add i18n function for string.

Co-authored-by: Carolina Nymark <[email protected]>
Copy link
Member

@JustinyAhin JustinyAhin left a comment

Choose a reason for hiding this comment

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

I have added a few comments about text domains.
Also, since a new page is being added in this, I'm wondering if there is something to do like redirection on Meta or something like that. cc @mkaz .

Looks good otherwise. Thank you for the PR @DaisyOlsen.

Copy link
Member

@mkaz mkaz left a comment

Choose a reason for hiding this comment

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

I added a minor typo update. Looks like Carolina and Justin did a great job with the document review 👍

Since this is creating a new file and not renaming anything we won't need any redirects.

@DaisyOlsen You will have to update toc.json and add the entry in to the Block API Reference area, you see the existing entries for how. After updating toc.json you need to run npm run docs:build and also add the updated manifest.json document.

Let me know if you have any questions and I can help.

docs/reference-guides/filters/block-filters.md Outdated Show resolved Hide resolved
@DaisyOlsen
Copy link
Contributor Author

@mkaz I've updated the toc and manifest files. Hopefully that is sufficient for this PR. I know there are other edits that should be made but the purpose of this PR is simply to move the content to it's own page. A more comprehensive PR to expand and clarify the content will follow.

@JustinyAhin JustinyAhin self-requested a review May 10, 2021 11:05
Copy link
Member

@JustinyAhin JustinyAhin left a comment

Choose a reason for hiding this comment

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

Overall it looks good to me.

Thanks for adding the requested changes @DaisyOlsen.

@carolinan carolinan merged commit 828be97 into WordPress:trunk May 10, 2021
@github-actions github-actions bot added this to the Gutenberg 10.7 milestone May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: Create Block Styles page in API Reference
5 participants