Skip to content

Commit

Permalink
Placeholders: Make dashed style a mixin, and apply across. (#43512)
Browse files Browse the repository at this point in the history
* Placeholders: Make dashed style a mixin, and apply across.

* Rename to placeholder-style and remove comments.
  • Loading branch information
jasmussen authored Aug 26, 2022
1 parent b4f6baa commit 8e72efe
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
8 changes: 7 additions & 1 deletion packages/base-styles/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@
}
}

@mixin placeholder-style() {
border: $border-width dashed currentColor;
border-radius: $radius-block-ui;
}

/**
* Allows users to opt-out of animations via OS-level preferences.
*/
Expand All @@ -226,7 +231,6 @@
animation-delay: 0s;
}
}

}

@mixin input-control {
Expand Down Expand Up @@ -371,6 +375,7 @@
* Reset default styles for JavaScript UI based pages.
* This is a WP-admin agnostic reset
*/

@mixin reset {
box-sizing: border-box;

Expand All @@ -384,6 +389,7 @@
/**
* Reset the WP Admin page styles for Gutenberg-like pages.
*/

@mixin wp-admin-reset( $content-container ) {
background: $white;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@
right: 0;
bottom: 0;
left: 0;
border: $border-width dashed currentColor;
opacity: 0.4;
border-radius: $radius-block-ui;
pointer-events: none;
@include placeholder-style();
}

.block-editor-inserter {
Expand Down
4 changes: 1 addition & 3 deletions packages/block-library/src/group/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@
&::after {
content: "";
display: flex;
border: $border-width dashed currentColor;
opacity: 0.4;
border-radius: $radius-block-ui;
flex: 1 0 $grid-unit-60;
pointer-events: none;
min-height: $grid-unit-60 - $border-width - $border-width;
@include placeholder-style();
}

// Let the parent be selectable in the placeholder area.
Expand Down
4 changes: 1 addition & 3 deletions packages/block-library/src/navigation/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,15 @@ $color-control-label-height: 20px;
right: 0;
bottom: 0;
left: 0;
border: $border-width dashed currentColor;
opacity: 0.4;
pointer-events: none;
@include placeholder-style();

// Inherit border radius from style variations.
border-radius: inherit;
}

> svg {
fill: currentColor;
opacity: 0.4;
}
}

Expand Down
5 changes: 1 addition & 4 deletions packages/components/src/placeholder/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@
box-shadow: none;
min-width: 100px;

// Radius fallback value.
border-radius: $radius-block-ui;

// Blur the background so layered dashed placeholders are still visually separate.
// We also provide a semitransparent background so as to allow duotones to sheen through.
backdrop-filter: blur(100px);
Expand Down Expand Up @@ -213,7 +210,7 @@
}

// By painting the borders here, we enable them to be replaced by the Border control.
border: $border-width dashed currentColor;
@include placeholder-style();
overflow: hidden;
}

Expand Down

0 comments on commit 8e72efe

Please sign in to comment.