Skip to content

Commit

Permalink
Simplify handle positioning variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joen Asmussen committed Jun 8, 2020
1 parent 27e548a commit ffe28be
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
36 changes: 16 additions & 20 deletions packages/block-editor/src/components/block-toolbar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,20 @@
}

// Show a draggable handle when you're dragging using the toolbar component.
.block-editor-block-toolbar__drag-clone {
margin-top: -$block-toolbar-height; // This puts it closer to the drag handle.

&::before {
content: "";
display: block;
position: absolute;
top: 0;
width: $button-size * 2;
height: $block-toolbar-height;
border-radius: $radius-block-ui;
background-color: $dark-gray-primary;
border: $border-width solid $dark-gray-primary;

// This should be reconsidered if successful.
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTcgMTYuNWgxMFYxNUg3djEuNXptMC05VjloMTBWNy41SDd6IiBmaWxsPSIjZmZmIi8+PC9zdmc+);
background-size: $icon-size;
background-repeat: no-repeat;
background-position: center center;
}
.block-editor-block-toolbar__drag-clone::before {
content: "";
display: block;
position: absolute;
top: -$block-toolbar-height - $grid-unit-15;
width: $button-size * 2;
height: $block-toolbar-height;
border-radius: $radius-block-ui;
background-color: $dark-gray-primary;
border: $border-width solid $dark-gray-primary;

// This should be reconsidered if successful.
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTcgMTYuNWgxMFYxNUg3djEuNXptMC05VjloMTBWNy41SDd6IiBmaWxsPSIjZmZmIi8+PC9zdmc+);
background-size: $icon-size;
background-repeat: no-repeat;
background-position: center center;
}
2 changes: 1 addition & 1 deletion packages/components/src/draggable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { withSafeTimeout } from '@wordpress/compose';
const dragImageClass = 'components-draggable__invisible-drag-image';
const cloneWrapperClass = 'components-draggable__clone';
const cloneHeightTransformationBreakpoint = 700;
const clonePadding = 20;
const clonePadding = 0;

class Draggable extends Component {
constructor() {
Expand Down
6 changes: 4 additions & 2 deletions packages/components/src/draggable/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ body.is-dragging-components-draggable {

.components-draggable__clone {
position: fixed;
padding: 20px;
padding: 0; // Should match clonePadding variable.
background: transparent;
pointer-events: none;
z-index: z-index(".components-draggable__clone");

> * {
opacity: 0.8;
// This needs specificity as a theme is meant to define these by default.
margin-top: 0 !important;
margin-bottom: 0 !important;
}
}

0 comments on commit ffe28be

Please sign in to comment.