Skip to content

Commit

Permalink
Blockbase: move button padding styles from ponyfill to theme.json
Browse files Browse the repository at this point in the history
  • Loading branch information
madhusudhand committed Apr 21, 2022
1 parent 70ee5b1 commit a6178d7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
6 changes: 0 additions & 6 deletions blockbase/assets/ponyfill.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion blockbase/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions blockbase/sass/blocks/_button.scss
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
@import 'button-mixins';
@import "button-mixins";

/**
* Button
*/

/**
* Block Options
*/
.wp-block-button, .wp-block-button__link {
.wp-block-button,
.wp-block-button__link {

&.wp-block-button__link,
.wp-block-button__link {

@include button-hover-styles;
@include button-padding-styles;
text-decoration: none;
font-weight: var(--wp--custom--button--typography--font-weight);
}

&.is-style-outline {

&.wp-block-button__link,
.wp-block-button__link {
--wp--custom--button--color--text: var(--wp--custom--button--border--color);
--wp--custom--button--color--background: transparent;

@include button-border-styles;
@include button-hover-styles;
@include button-color-styles;
Expand All @@ -30,6 +35,7 @@
// a button block OUTSIDE of the context of the button collection block (grrrrrrrrr)
// then there are undesired margins to be dealt with somehow.
.wp-block-buttons {

.wp-block-button:last-child {
margin-bottom: 0;
}
Expand Down
11 changes: 10 additions & 1 deletion blockbase/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@
"blocks": {
"core/button": {
"border": {
"radius": "var(--wp--custom--button--border--radius)"
"radius": "var(--wp--custom--button--border--radius)",
"width": "0"
},
"color": {
"background": "var(--wp--custom--button--color--background)",
Expand All @@ -412,6 +413,14 @@
"fontSize": "var(--wp--custom--button--typography--font-size)",
"fontWeight": "var(--wp--custom--button--typography--font-weight)",
"lineHeight": "var(--wp--custom--button--typography--line-height)"
},
"spacing": {
"padding": {
"top": "calc( var(--wp--custom--button--spacing--padding--top) + var(--wp--custom--button--border--width) )",
"bottom": "calc( var(--wp--custom--button--spacing--padding--bottom) + var(--wp--custom--button--border--width) )",
"left": "calc( var(--wp--custom--button--spacing--padding--left) + var(--wp--custom--button--border--width) )",
"right": "calc( var(--wp--custom--button--spacing--padding--right) + var(--wp--custom--button--border--width) )"
}
}
},
"core/code": {
Expand Down

0 comments on commit a6178d7

Please sign in to comment.