From 4128f21beebae8bf1a6071704c371b8fdec3dceb Mon Sep 17 00:00:00 2001 From: Joen Asmussen Date: Tue, 4 Sep 2018 10:25:45 +0200 Subject: [PATCH] Polish drag handle and metrics This makes the drag handle and up/down buttons slightly smaller, and centers them. --- .../src/components/block-mover/arrows.js | 9 ++--- .../src/components/block-mover/style.scss | 36 ++++++++++++------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/packages/editor/src/components/block-mover/arrows.js b/packages/editor/src/components/block-mover/arrows.js index 00a9886d6f982..9590941c0d8e1 100644 --- a/packages/editor/src/components/block-mover/arrows.js +++ b/packages/editor/src/components/block-mover/arrows.js @@ -12,11 +12,8 @@ export const downArrow = ( export const dragHandle = ( - - - - - - + ); diff --git a/packages/editor/src/components/block-mover/style.scss b/packages/editor/src/components/block-mover/style.scss index b651d22bb82fe..9d569b8a6a310 100644 --- a/packages/editor/src/components/block-mover/style.scss +++ b/packages/editor/src/components/block-mover/style.scss @@ -6,9 +6,19 @@ &.is-visible { @include fade_in; } + + // 24px is the smallest size of a good pressable button. + // With 3 pieces of side UI, that comes to a total of 72px. + // To vertically center against a 56px paragraph, move upwards 72px - 56px / 2. + // Don't do this for wide, fullwide, or mobile. + @include break-small() { + .editor-block-list__block:not([data-align="wide"]):not([data-align="full"]) & { + margin-top: -8px; + } + } } -// Mover icon buttons +// Mover icon buttons. .editor-block-mover__control { display: flex; align-items: center; @@ -18,11 +28,19 @@ background: none; cursor: pointer; padding: 0; - width: $block-side-ui-width; - height: $block-side-ui-width; // the side UI can be no taller than 2 * $block-side-ui-width, which matches the height of a line of text border-radius: $radius-round-rectangle; - // use opacity to work in various editor styles + // Carefully adjust the size of the side UI to fit one paragraph of text (56px). + width: $block-side-ui-width; + height: $icon-button-size-small; + + svg { + width: $block-side-ui-width; + height: $icon-button-size-small; + padding: #{ ($block-side-ui-width - $icon-button-size-small) / 2 } #{ ($block-side-ui-width - 18px) / 2 }; // This makes the SVG fill the whole available area, without scaling the artwork. + } + + // Use opacity to work in various editor styles color: $dark-opacity-300; .is-dark-theme & { @@ -32,20 +50,14 @@ &[aria-disabled="true"] { cursor: default; pointer-events: none; - color: $dark-opacity-light-300; // use opacity to work in various editor styles + color: $dark-opacity-light-300; // Use opacity to work in various editor styles. .is-dark-theme & { color: $light-opacity-light-300; } } - svg { - width: $block-side-ui-width; - height: $block-side-ui-width; - padding: ($block-side-ui-width - 18px) / 2; // this makes the SVG fill the whole available area, without scaling the artwork - } - - // Apply a background in nested contexts, only on desktop + // Apply a background in nested contexts, only on desktop. @include break-small() { .editor-block-list__layout .editor-block-list__layout & { background: $white;