Skip to content

Commit

Permalink
Try: Refactor appender margin. (#33088)
Browse files Browse the repository at this point in the history
* Try: Refactor appender margin.

* Expand comment.

* Add clarifying comment.
  • Loading branch information
jasmussen authored and youknowriad committed Jul 6, 2021
1 parent 4ac403f commit 33db8f1
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions packages/block-editor/src/components/block-list-appender/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,35 @@
max-width: none;
}

// Add a little left margin when used horizontally.
// The right margin should be set to auto, so as to not shift layout in flex containers.
margin: 0 auto 0 $grid-unit-10;

// ... unless it's the only child.
&:first-child {
margin-left: 0;
}

.block-editor-default-block-appender {
margin: $grid-unit-10 0;
}

// Animate appearance.
// Add an explicit left margin of zero and auto right margin to work in horizontal
// flex containers. Without it, a "space-between"-like effect from two auto margins
// will cause the black plus to sit in the center of what space is left.
margin: 0 auto 0 0;

// Black square plus appender.
.block-list-appender__toggle {
padding: 0;

// Animate appearance.
opacity: 1;
transform: scale(1);
transition: all 0.1s ease;
@include reduce-motion("transition");

// The black square button should have a little left margin in horizontal containers.
margin-left: $grid-unit-10;
}

// Cancel any left margin if the black plus sits alone in the container.
// `first-of-type` is used instead of `first-child` as the element is not always the only
// element in the "empty" container. For example the empty navigation block state has a
// zero-width placeholder state that is meant to help correctly size the dimensions.
&:first-of-type .block-list-appender__toggle {
margin-left: 0;
}
}

Expand Down

0 comments on commit 33db8f1

Please sign in to comment.