-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add visual indicator if a block is connected to block binding source #59185
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
Merged
michalczaplinski
merged 19 commits into
trunk
from
fix/update-block-bindings-ui-indicator
Feb 29, 2024
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6bcef66
Add BlockControlsFirst slot to block controls groups
michalczaplinski 3d6fe72
Add connection icon to BlockControls toolbar button
michalczaplinski 385b13c
Add block binding toolbar button if block is connected to a source
michalczaplinski 44b1c72
Add i18n support for block toolbar button label
michalczaplinski 91c78a4
Add BlockBindingsButton component and remove BlockControlsFirst group
michalczaplinski be8afcd
Refactor BlockBindingsButton to check for block connections
michalczaplinski 1c51cc2
Change the ToolbarButton label
michalczaplinski 752dcc3
Update block-bindings-button import to block-bindings-indicator
michalczaplinski bbdd7bf
Block Bindings: Add connection icon to list view (#59331)
artemiomorales 3bc3062
Move bindings style to useBlockProps
artemiomorales 9d6f97c
Remove extraneous comment
artemiomorales ec3885d
Move bindings selector logic to toolbar
artemiomorales d9a4b88
Rename indicator file
artemiomorales d571f82
Move purple stroke style from SVG markup to CSS
artemiomorales 6cd25eb
Merge branch 'trunk' into fix/update-block-bindings-ui-indicator
artemiomorales ac72c0a
Check if block can be bound before adding styles
artemiomorales f63e4ef
Simplify the SVG icon:
michalczaplinski 3f9fa3b
Update the CSS namespacing to include the `__`
michalczaplinski 4dc1103
Fix issues with block binding indicator color
michalczaplinski 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
|
|
||
| // It is important to include these styles in all built stylesheets. | ||
| // This allows to CSS variables post CSS plugin to generate fallbacks. | ||
| // It also provides default CSS variables for npm package consumers. | ||
| :root { | ||
| @include admin-scheme(#007cba); | ||
| --wp-block-synced-color: #7a00df; | ||
| --wp-block-synced-color--rgb: #{hex-to-rgb(#7a00df)}; | ||
| --wp-bound-block-color: #9747ff; | ||
| } |
20 changes: 20 additions & 0 deletions
20
packages/block-editor/src/components/block-bindings-toolbar-indicator/index.js
This file contains hidden or 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,20 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { ToolbarItem, ToolbarGroup, Icon } from '@wordpress/components'; | ||
| import { connection } from '@wordpress/icons'; | ||
| import { _x } from '@wordpress/i18n'; | ||
|
|
||
| export default function BlockBindingsToolbarIndicator() { | ||
| return ( | ||
| <ToolbarGroup> | ||
| <ToolbarItem | ||
| as={ 'div' } | ||
| aria-label={ _x( 'Connected', 'block toolbar button label' ) } | ||
| className="block-editor-block-bindings-toolbar-indicator" | ||
| > | ||
| <Icon icon={ connection } size={ 24 } /> | ||
| </ToolbarItem> | ||
| </ToolbarGroup> | ||
| ); | ||
| } |
14 changes: 14 additions & 0 deletions
14
packages/block-editor/src/components/block-bindings-toolbar-indicator/style.scss
This file contains hidden or 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,14 @@ | ||
| .block-editor-block-bindings-toolbar-indicator { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| height: 48px; | ||
| padding: 6px; | ||
|
|
||
| svg g { | ||
| stroke: var(--wp-bound-block-color); | ||
| fill: transparent; | ||
| stroke-width: 1.5; | ||
| stroke-linecap: round; | ||
| stroke-linejoin: round; | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,25 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { SVG, Path, G } from '@wordpress/primitives'; | ||
|
|
||
| const connection = ( | ||
|
michalczaplinski marked this conversation as resolved.
|
||
| <SVG | ||
| width="24" | ||
| height="24" | ||
| viewBox="0 0 24 24" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| fill-rule="evenodd" | ||
| > | ||
| <Path d="M5 19L8 16L5 19Z" /> | ||
| <Path d="M16 8L19 5L16 8Z" /> | ||
| <G> | ||
| <Path d="M5 19L8 16" /> | ||
| <Path d="M9.30003 17.3C9.523 17.5237 9.78794 17.7013 10.0797 17.8224C10.3714 17.9435 10.6842 18.0059 11 18.0059C11.3159 18.0059 11.6287 17.9435 11.9204 17.8224C12.2121 17.7013 12.4771 17.5237 12.7 17.3L15 15L9.00003 9L6.70003 11.3C6.47629 11.523 6.29876 11.7879 6.17763 12.0796C6.05649 12.3714 5.99414 12.6841 5.99414 13C5.99414 13.3159 6.05649 13.6286 6.17763 13.9204C6.29876 14.2121 6.47629 14.477 6.70003 14.7L9.30003 17.3Z" /> | ||
| <Path d="M16 8L19 5" /> | ||
| <Path d="M9 9.00003L15 15L17.3 12.7C17.5237 12.4771 17.7013 12.2121 17.8224 11.9204C17.9435 11.6287 18.0059 11.3159 18.0059 11C18.0059 10.6842 17.9435 10.3714 17.8224 10.0797C17.7013 9.78794 17.5237 9.523 17.3 9.30003L14.7 6.70003C14.477 6.47629 14.2121 6.29876 13.9204 6.17763C13.6286 6.05649 13.3159 5.99414 13 5.99414C12.6841 5.99414 12.3714 6.05649 12.0796 6.17763C11.7879 6.29876 11.523 6.47629 11.3 6.70003L9 9.00003Z" /> | ||
| </G> | ||
| </SVG> | ||
| ); | ||
|
|
||
| export default connection; | ||
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.
Uh oh!
There was an error while loading. Please reload this page.