-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for button elements to theme.json (#40260)
* Add button component for blocks * Add button component for blocks * also use the blockbutton for the search block * update search block icon button * Rename to ElementButton * Add content version of the component * refactor to remove duplicate code * linting fix * Add a deprecation * Move code to 6.1 version of theme.json * also output a button rather than richtext, when children are present * adding missing file * ignore lint * Add the wp-block-button class to the element selector * update fixtures * linting fix' * remove disconnected change * Remove ElementButton component and replace with a const * use a hook to supply the element button class * use the same class name in the search button server side render * simply to just use a const * add documentation * remove unneeded code * remove unneeded code * also make button a selector * remove unneeded changes * Expose the classname const from block editor package * Update packages/block-library/src/button/deprecated.js Co-authored-by: Adam Zielinski <[email protected]> * update button element const * Make the const all uppercase * fix spacing * update snapshots * add test Co-authored-by: Dave Smith <[email protected]> Co-authored-by: Adam Zielinski <[email protected]>
- Loading branch information
1 parent
323174a
commit 046ca65
Showing
27 changed files
with
204 additions
and
36 deletions.
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.