Skip to content

Commit

Permalink
Restore visual separator between mover buttons when show button label…
Browse files Browse the repository at this point in the history
… is on (#57640)

* Restore visual separator between mover buttons when show button labels is on.

* Style block movers separator for Top toolbar.

* Reuse existing CSS selector.

* Improve horizontal separator positioning.
  • Loading branch information
afercia authored Jan 12, 2024
1 parent 75acb7e commit 7fce392
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 23 deletions.
31 changes: 18 additions & 13 deletions packages/block-editor/src/components/block-toolbar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,24 @@

.block-editor-block-mover .block-editor-block-mover__move-button-container {
width: auto;

@include break-small() {
position: relative;

&::before {
content: "";
height: $border-width;
width: 100%;
background: $gray-900;
position: absolute;
top: 50%;
left: 50%;
// With Top toolbar enabled, this separator has a smaller width. Translating the
// X axis allows to make the separator always centered regardless of its width.
transform: translate(-50%, 0);
margin-top: -$border-width * 0.5;
}
}
}

.block-editor-block-mover.is-horizontal {
Expand Down Expand Up @@ -231,19 +249,6 @@
padding-right: $grid-unit-15;
}

@include break-small() {
// Specificity override for https://github.com/WordPress/gutenberg/blob/try/block-toolbar-labels/packages/block-editor/src/components/block-mover/style.scss#L69
.is-up-button.is-up-button.is-up-button {
margin-right: 0;
border-radius: 0;
order: 1;
}

.is-down-button.is-down-button.is-down-button {
order: 2;
}
}

.block-editor-block-contextual-toolbar .block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button {
width: auto;
}
Expand Down
17 changes: 13 additions & 4 deletions packages/edit-post/src/components/header/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
margin-left: $grid-unit;
}

// Modified group borders
// Modified group borders.
.components-toolbar-group,
.components-toolbar {
border-right: none;
Expand Down Expand Up @@ -194,18 +194,27 @@
}

.show-icon-labels {

.edit-post-header__toolbar .block-editor-block-mover {
// Modified group borders.
border-left: none;

&::before {
content: "";
width: $border-width;
margin-top: $grid-unit + $grid-unit-05;
margin-bottom: $grid-unit + $grid-unit-05;
margin-top: $grid-unit-15;
margin-bottom: $grid-unit-15;
background-color: $gray-300;
margin-left: $grid-unit;
}

// Modified block movers horizontal separator.
.block-editor-block-mover__move-button-container {
&::before {
width: calc(100% - #{$grid-unit-30});
background: $gray-300;
left: calc(50% + 1px);
}
}
}
}

Expand Down
20 changes: 15 additions & 5 deletions packages/edit-site/src/components/header-edit-mode/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,26 @@ $header-toolbar-min-width: 335px;
}

.block-editor-block-mover {
// Modified group borders.
border-left: none;

&::before {
content: "";
width: $border-width;
margin-top: $grid-unit + $grid-unit-05;
margin-bottom: $grid-unit + $grid-unit-05;
margin-top: $grid-unit-15;
margin-bottom: $grid-unit-15;
background-color: $gray-300;
margin-left: $grid-unit;
}

// Modified block movers horizontal separator.
.block-editor-block-mover__move-button-container {
&::before {
width: calc(100% - #{$grid-unit-30});
background: $gray-300;
left: calc(50% + 1px);
}
}
}
}

Expand All @@ -164,16 +174,16 @@ $header-toolbar-min-width: 335px;
border-bottom: 0;
}

// Modified group borders
// Modified group borders.
.components-toolbar-group,
.components-toolbar {
border-right: none;

&::after {
content: "";
width: $border-width;
margin-top: $grid-unit + $grid-unit-05;
margin-bottom: $grid-unit + $grid-unit-05;
margin-top: $grid-unit-15;
margin-bottom: $grid-unit-15;
background-color: $gray-300;
margin-left: $grid-unit;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-widgets/src/components/header/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
border-bottom: 0;
}

// Modified group borders
// Modified group borders.
.components-toolbar-group,
.components-toolbar {
border-right: none;
Expand Down

0 comments on commit 7fce392

Please sign in to comment.