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

@DaisyOlsen DaisyOlsen requested review from JustinyAhin and mkaz Apr 21, 2021

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.

This comment has been minimized.

@carolinan

carolinan Apr 22, 2021
Contributor

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

This comment has been minimized.

@DaisyOlsen

DaisyOlsen Apr 22, 2021
Author Contributor

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:

This comment has been minimized.

@carolinan

carolinan Apr 22, 2021
Contributor

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.

This comment has been minimized.

@DaisyOlsen

DaisyOlsen Apr 22, 2021
Author Contributor

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.

DaisyOlsen and others added 2 commits Apr 22, 2021
fix typo

Co-authored-by: Carolina Nymark <[email protected]>
add i18n function for string.

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

@JustinyAhin JustinyAhin left a comment

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

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
Co-authored-by: Marcus Kazmierczak <[email protected]>
carolinan and others added 3 commits Apr 24, 2021
@DaisyOlsen
Copy link
Contributor Author

@DaisyOlsen DaisyOlsen commented May 6, 2021

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

@JustinyAhin JustinyAhin left a comment

Overall it looks good to me.

Thanks for adding the requested changes @DaisyOlsen.

@carolinan carolinan merged commit 828be97 into WordPress:trunk May 10, 2021
19 checks passed
19 checks passed
@github-actions
Bump version
Details
@github-actions
Cancel Previous Runs
Details
@github-actions
Check
Details
@github-actions
Checks (12)
Details
@github-actions
Admin - 1 Admin - 1
Details
@github-actions
Run performance tests
Details
@github-actions
test (gutenberg-editor-initial-html)
Details
@github-actions
test (12.2, gutenberg-editor-initial-html)
Details
@github-actions
JavaScript (12)
Details
@github-actions
Checks (14)
Details
@github-actions
Admin - 2 Admin - 2
Details
@github-actions
JavaScript (14)
Details
@github-actions
Admin - 3 Admin - 3
Details
@github-actions
Admin - 4 Admin - 4
Details
@github-actions
Build Release Artifact
Details
@github-actions
Create Release Draft and Attach Asset
Details
@github-actions
Mobile
Details
@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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants