Skip to content
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

Try: Fix buttons faux space-between. #28485

Merged
merged 2 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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