-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Changes from 17 commits
6bcef66
3d6fe72
385b13c
44b1c72
91c78a4
be8afcd
1c51cc2
752dcc3
bbdd7bf
3bc3062
9d6f97c
ec3885d
d9a4b88
d571f82
6cd25eb
ac72c0a
f63e4ef
3f9fa3b
4dc1103
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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-indicator block-toolbar-block-bindings-indicator" | ||
| > | ||
| <Icon icon={ connection } size={ 24 } /> | ||
| </ToolbarItem> | ||
| </ToolbarGroup> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||
| .block-toolbar-block-bindings-indicator { | ||||
| display: inline-flex; | ||||
| align-items: center; | ||||
| height: 48px; | ||||
| padding: 6px; | ||||
| } | ||||
|
|
||||
| .block-editor-block-bindings-indicator svg g { | ||||
| stroke: #9747ff; | ||||
|
||||
| --wp-block-synced-color: #7a00df; |
Currently the color of the "bound" blocks is #9747ff which is close but different from synced blocks color (#7a00df). Should it be the same?
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, in 4dc1103, I've added a new --wp-bound-block-color property to _default-custom-properties.scss that I reused in other components.
We can still change this color in the future.
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'd defer to Saxon, but my instinct would've been to make these the same, so it could be good to follow up and retire the variable. We do reuse colors like this, there should almost never be stray hex codes in the codebase. But at the same time we're also very careful with introducing new variables. Sorry for the delayed response @michalczaplinski
| 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.
Show resolved
Hide 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; | ||
Uh oh!
There was an error while loading. Please reload this page.