-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 support for button elements to theme.json #40260
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
569389a
Add button component for blocks
scruffian 0487f9f
Add button component for blocks
scruffian 4994996
also use the blockbutton for the search block
scruffian 533a32b
update search block icon button
scruffian 353a149
Rename to ElementButton
scruffian b855667
Add content version of the component
scruffian a6c0ac2
refactor to remove duplicate code
scruffian b4faf9e
linting fix
scruffian 0206097
Add a deprecation
scruffian 41a5ac1
Move code to 6.1 version of theme.json
scruffian 5f546da
also output a button rather than richtext, when children are present
scruffian 35392df
adding missing file
scruffian 6af1644
ignore lint
scruffian c03bf9d
Add the wp-block-button class to the element selector
scruffian 3489f7d
update fixtures
scruffian 0c7c100
linting fix'
scruffian fc2b78c
remove disconnected change
scruffian 5abe8f7
Remove ElementButton component and replace with a const
scruffian 75735f3
use a hook to supply the element button class
scruffian 6c36cb3
use the same class name in the search button server side render
scruffian cf569c7
simply to just use a const
scruffian c10501d
add documentation
scruffian c1fa1f9
remove unneeded code
scruffian 6ca12ed
remove unneeded code
scruffian cc917e4
also make button a selector
scruffian 0587fc0
remove unneeded changes
scruffian 5dd8872
Expose the classname const from block editor package
getdave b3a2480
Update packages/block-library/src/button/deprecated.js
scruffian b7c560d
update button element const
scruffian 3175392
Make the const all uppercase
scruffian d076dd4
fix spacing
scruffian efbcd29
update snapshots
scruffian 5bc74fa
add test
scruffian 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 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,6 +1,6 @@ | ||
<?php | ||
/** | ||
* WP_Theme_JSON_Gutenberg class | ||
* WP_Theme_JSON_6_0 class | ||
* | ||
* @package gutenberg | ||
*/ | ||
|
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
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 @@ | ||
export const __experimentalElementButtonClassName = 'wp-element-button'; |
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
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
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
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
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
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
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
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
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
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
2 changes: 1 addition & 1 deletion
2
test/integration/fixtures/blocks/core__button__border_radius__deprecated-2.serialized.html
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!-- wp:button {"className":"is-style-outline","style":{"border":{"radius":"10px"},"color":{"text":"#1b9b6c"}}} --> | ||
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link has-text-color" style="border-radius:10px;color:#1b9b6c">Where We Are</a></div> | ||
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link has-text-color wp-element-button" style="border-radius:10px;color:#1b9b6c">Where We Are</a></div> | ||
<!-- /wp:button --> |
2 changes: 1 addition & 1 deletion
2
test/integration/fixtures/blocks/core__button__border_radius__deprecated.serialized.html
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!-- wp:button {"style":{"border":{"radius":"25px"}}} --> | ||
<div class="wp-block-button"><a class="wp-block-button__link" style="border-radius:25px">My button</a></div> | ||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" style="border-radius:25px">My button</a></div> | ||
<!-- /wp:button --> | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
test/integration/fixtures/blocks/core__button__center__deprecated.serialized.html
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!-- wp:button {"align":"center"} --> | ||
<div class="wp-block-button aligncenter"><a class="wp-block-button__link" href="https://github.com/WordPress/gutenberg">Help build Gutenberg</a></div> | ||
<div class="wp-block-button aligncenter"><a class="wp-block-button__link wp-element-button" href="https://github.com/WordPress/gutenberg">Help build Gutenberg</a></div> | ||
<!-- /wp:button --> |
2 changes: 1 addition & 1 deletion
2
test/integration/fixtures/blocks/core__button__deprecated-v10.serialized.html
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!-- wp:button {"fontFamily":"cambria-georgia"} --> | ||
<div class="wp-block-button has-cambria-georgia-font-family"><a class="wp-block-button__link">My button</a></div> | ||
<div class="wp-block-button has-cambria-georgia-font-family"><a class="wp-block-button__link wp-element-button">My button</a></div> | ||
<!-- /wp:button --> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!-- wp:button {"style":{"border":{"radius":0},"color":{"text":"#1b9b6c","background":"#aa5a20"}}} --> | ||
<div class="wp-block-button"><a class="wp-block-button__link no-border-radius has-text-color has-background" style="background-color:#aa5a20;color:#1b9b6c">My button</a></div> | ||
<div class="wp-block-button"><a class="wp-block-button__link no-border-radius has-text-color has-background wp-element-button" style="background-color:#aa5a20;color:#1b9b6c">My button</a></div> | ||
<!-- /wp:button --> |
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
2 changes: 1 addition & 1 deletion
2
test/integration/fixtures/blocks/core__button__squared.serialized.html
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!-- wp:button {"style":{"border":{"radius":0},"color":{"text":"#1b9b6c","background":"#aa5a20"}}} --> | ||
<div class="wp-block-button"><a class="wp-block-button__link has-text-color has-background no-border-radius" style="color:#1b9b6c;background-color:#aa5a20">My button</a></div> | ||
<div class="wp-block-button"><a class="wp-block-button__link has-text-color has-background no-border-radius wp-element-button" style="color:#1b9b6c;background-color:#aa5a20">My button</a></div> | ||
<!-- /wp:button --> |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<!-- wp:buttons {"align":"wide","layout":{"type":"flex","justifyContent":"center"}} --> | ||
<div class="wp-block-buttons alignwide"> | ||
<!-- wp:button --> | ||
<div class="wp-block-button"><a class="wp-block-button__link">My button 1</a></div> | ||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button">My button 1</a></div> | ||
<!-- /wp:button --> | ||
|
||
<!-- wp:button --> | ||
<div class="wp-block-button"><a class="wp-block-button__link">My button 2</a></div> | ||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button">My button 2</a></div> | ||
<!-- /wp:button --> | ||
</div> | ||
<!-- /wp:buttons --> | ||
<!-- /wp:buttons --> |
Oops, something went wrong.
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 still have no idea what these files do and why this change is required.
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.
This just fixes a typo – the class name declared below is WP_Theme_JSON_6_0