Skip to content

Commit

Permalink
Try: Fix buttons faux space-between. (#28485)
Browse files Browse the repository at this point in the history
* Try: Fix buttons faux space-between.

* TT1 fix.
  • Loading branch information
jasmussen authored and noisysocks committed Feb 7, 2021
1 parent 76eba7c commit fb0e10d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/base-styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* Please use variables from this sheet to ensure consistency across the UI.
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
*/

@import "./colors";
Expand Down Expand Up @@ -43,7 +44,6 @@ $grid-unit-60: 6 * $grid-unit; // 48px
*/

$icon-size: 24px;
$button-margin: 0.5em;
$button-size: 36px;
$button-size-small: 24px;
$header-height: 60px;
Expand Down
9 changes: 6 additions & 3 deletions packages/block-library/src/button/style.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
$blocks-button__height: 3.1em;

// This variable is repeated across Button, Buttons, and Buttons editor styles.
$blocks-block__margin: 0.5em;

// Prefer the link selector instead of the regular button classname
// to support the previous markup in addition to the new one.
.wp-block-button__link {
Expand Down Expand Up @@ -43,15 +46,15 @@ $blocks-button__height: 3.1em;
}

&.wp-block-button__width-25 {
width: calc(25% - #{ $button-margin });
width: calc(25% - #{ $blocks-block__margin });
}

&.wp-block-button__width-50 {
width: calc(50% - #{ $button-margin });
width: calc(50% - #{ $blocks-block__margin });
}

&.wp-block-button__width-75 {
width: calc(75% - #{ $button-margin });
width: calc(75% - #{ $blocks-block__margin });
}

&.wp-block-button__width-100 {
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/buttons/editor.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This variable is repeated across Button, Buttons, and Buttons editor styles.
$blocks-block__margin: 0.5em;

.wp-block > .wp-block-buttons {
display: flex;
flex-wrap: wrap;
Expand All @@ -7,7 +10,8 @@
> .wp-block {
// Override editor auto block margins.
margin-left: 0;
margin-top: $button-margin;
margin-top: $blocks-block__margin;
margin-right: $blocks-block__margin;
}
> .block-list-appender {
display: inline-flex;
Expand Down
15 changes: 10 additions & 5 deletions packages/block-library/src/buttons/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This variable is repeated across Button, Buttons, and Buttons editor styles.
$blocks-block__margin: 0.5em;

.wp-block-buttons {
display: flex;
flex-direction: row;
Expand All @@ -18,8 +21,10 @@
> .wp-block-button {
display: inline-block;
/*rtl:ignore*/
margin-right: $button-margin;
margin-bottom: $button-margin;
margin-left: 0;
/*rtl:ignore*/
margin-right: $blocks-block__margin;
margin-bottom: $blocks-block__margin;

&:last-child {
/*rtl:ignore*/
Expand All @@ -46,7 +51,7 @@

> .wp-block-button {
/*rtl:ignore*/
margin-left: $button-margin;
margin-left: $blocks-block__margin;
/*rtl:ignore*/
margin-right: 0;

Expand All @@ -69,7 +74,7 @@
/*rtl:ignore*/
margin-left: 0;
/*rtl:ignore*/
margin-right: $button-margin;
margin-right: $blocks-block__margin;

&:last-child {
/*rtl:ignore*/
Expand All @@ -80,7 +85,7 @@
/*rtl:ignore*/
margin-right: 0;
/*rtl:ignore*/
margin-left: $button-margin;
margin-left: $blocks-block__margin;

&:first-child {
/*rtl:ignore*/
Expand Down

0 comments on commit fb0e10d

Please sign in to comment.