-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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/block breadcrumb component readme #24827
Merged
youknowriad
merged 7 commits into
WordPress:master
from
JustinyAhin:add/block-breadcrumb-component-readme
Aug 28, 2020
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3053de0
Add block breadcrumb component readme
JustinyAhin 2dc1577
Update block breadcrumb component readme
JustinyAhin 41193f4
Update block breadcrumb component readme
JustinyAhin e59417a
Update block breadcrumb component README
JustinyAhin bfba081
Add link to BlockEditorProvider README
JustinyAhin cfa484e
Update JSX example
JustinyAhin f43c7a9
Update JSX code example
JustinyAhin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
packages/block-editor/src/components/block-breadcrumb/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Block Breadcrumb | ||
|
||
The block breadcrumb trail displays the hierarchy of the current block selection as a breadcrumb. It also allows, using this hierarchy, to navigate to the parent elements of the current block selection. It is located at the very bottom of the editor interface. | ||
|
||
![Button block breadcrumb](https://make.wordpress.org/core/files/2020/08/gutenberg-button-block-breadcrumb.png) | ||
|
||
![Image in column block breadcrumb](https://make.wordpress.org/core/files/2020/08/gutenberg-image-in-column-block-breadcrumb.png) | ||
|
||
## Table of contents | ||
|
||
1. [Development guidelines](#development-guidelines) | ||
2. [Related components](#related-components) | ||
|
||
|
||
## Development guidelines | ||
|
||
### Usage | ||
|
||
Renders a block breadcrumb with default style. | ||
|
||
```jsx | ||
import { BlockBreadcrumb } from '@wordpress/block-editor'; | ||
|
||
const MyBreadcrumb = () => <BlockBreadcrumb />; | ||
``` | ||
|
||
## Related components | ||
|
||
Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/provider/README.md) in the components tree. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think most components in the
block-editor
package including this one need to be embedded in the React tree underBlockEditorProvider
. I wonder if it's worth mentioning in the READMEs of the different components or not.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, I think we should include in each example, because a developer may approach any page without seeing others, the more we can do to make the examples "just work" when copy-and-paste the better.
The example could be just updated to, if you want to include the
<div>
it'd be fine too, but probably not necessary.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.
That's not sufficient though because using
BlockEditorProvider
is more complex than that. Maybe we can link to its README?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.
Ok, just updated the example with
BlockEditorProvider
.Is there anything thing else that should be added?
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.
Maybe add something in a "Related components" section?
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.
I personally think we should revert to your original code example but add a sentence like that somewhere:
and link the word
BlockEditorProvider
to its README.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.
✅
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.
Works for me. The BlockEditorProvider readme has a complete example 👍