From 11316ead07df1591f6f9c61640782d40b97b0f67 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Mon, 30 Sep 2024 14:52:43 +0200 Subject: [PATCH] Use standard button variations for the Post featured image UI. --- .../components/post-featured-image/index.js | 91 ++++++++++--------- .../components/post-featured-image/style.scss | 21 +---- 2 files changed, 52 insertions(+), 60 deletions(-) diff --git a/packages/editor/src/components/post-featured-image/index.js b/packages/editor/src/components/post-featured-image/index.js index cabd791e938bf5..81e4d40a8169f4 100644 --- a/packages/editor/src/components/post-featured-image/index.js +++ b/packages/editor/src/components/post-featured-image/index.js @@ -173,46 +173,51 @@ function PostFeaturedImage( { allowedTypes={ ALLOWED_MEDIA_TYPES } modalClass="editor-post-featured-image__media-modal" render={ ( { open } ) => ( -
- + <> +
+ + +
{ !! featuredImageId && ( @@ -230,13 +236,14 @@ function PostFeaturedImage( { onRemoveImage(); toggleRef.current.focus(); } } + variant="secondary" + isDestructive > { __( 'Remove' ) } ) } - -
+ ) } value={ featuredImageId } /> diff --git a/packages/editor/src/components/post-featured-image/style.scss b/packages/editor/src/components/post-featured-image/style.scss index 30d5cb43403cdf..02e8115b6c0ff0 100644 --- a/packages/editor/src/components/post-featured-image/style.scss +++ b/packages/editor/src/components/post-featured-image/style.scss @@ -5,22 +5,14 @@ position: absolute; top: 50%; left: 50%; - margin-top: -9px; - margin-left: -9px; + margin: 0; + transform: translate(-50%, -50%); } } .editor-post-featured-image__container { position: relative; - &:hover, - &:focus, - &:focus-within { - .editor-post-featured-image__actions { - opacity: 1; - } - } - .components-drop-zone__content { border-radius: $radius-small; } @@ -72,17 +64,10 @@ } .editor-post-featured-image__actions { - @include reduce-motion("transition"); - bottom: 0; - opacity: 0; // Use opacity instead of visibility so that the buttons remain in the tab order. - padding: $grid-unit-10; - position: absolute; - transition: opacity 50ms ease-out; + padding: $grid-unit-10 0; } .editor-post-featured-image__action { - backdrop-filter: blur(16px) saturate(180%); - background: rgba(255, 255, 255, 0.75); flex-grow: 1; justify-content: center; }