From 33d72bde8cb87c5205617acca9c5cb9e26378935 Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Thu, 31 Oct 2024 13:15:15 +0100 Subject: [PATCH 1/4] External Media / AI Image Generator: update button style See #39934 Let's change the overall styles of the 2 buttons ("Select Image" and "Generate with AI"): - the buttons should be 40px high, like in Core. See https://github.com/WordPress/gutenberg/issues/46741 - the buttons should use the secondary style variant by default, to match the "Insert from URL" button. - the buttons should take the full width of the placeholder on mobile devices. --- .../jetpack/changelog/fix-external-media-button | 4 ++++ .../extensions/shared/external-media/editor.scss | 15 +++++---------- .../media-button/media-ai-button.js | 3 ++- .../external-media/media-button/media-menu.js | 5 ++--- 4 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 projects/plugins/jetpack/changelog/fix-external-media-button diff --git a/projects/plugins/jetpack/changelog/fix-external-media-button b/projects/plugins/jetpack/changelog/fix-external-media-button new file mode 100644 index 0000000000000..60f0ae8dd7805 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-external-media-button @@ -0,0 +1,4 @@ +Significance: patch +Type: compat + +External Media: ensure that the image block's external media picker button remains consistent with the other buttons in the image block. diff --git a/projects/plugins/jetpack/extensions/shared/external-media/editor.scss b/projects/plugins/jetpack/extensions/shared/external-media/editor.scss index deaa53f64996f..0d6c1531a7786 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/editor.scss +++ b/projects/plugins/jetpack/extensions/shared/external-media/editor.scss @@ -144,7 +144,6 @@ $grid-size: 8px; font-weight: 400; line-height: 1.43; color: var( --jp-gray-60 ); - text-align: left; margin: 0; } .jetpack-external-media-wrapper__jetpack_app_media-wrapper.has-no-image-uploaded { @@ -543,33 +542,29 @@ $grid-size: 8px; } .jetpack-external-media-button-menu__dropdown { - width: 100%; + display: flex; .jetpack-external-media-button-menu { width: 100%; flex-direction: row; - text-align: left; padding-left: 12px; padding-right: 12px; - - .jetpack-external-media-button-menu__label { - flex-grow: 2; - } } } // Set the wrapper as a flex container to allow displaying multiple buttons side by side. .jetpack-external-media-button-wrapper { - display: flex; + @media only screen and ( min-width: 783px ) { + display: flex; + gap: $grid-size * 2; + } } // Reset placeholder button margin. .components-placeholder__fieldset, .editor-post-featured-image { .components-dropdown .jetpack-external-media-button-menu { - width: auto; margin-bottom: 1em; - > svg { display: none; } diff --git a/projects/plugins/jetpack/extensions/shared/external-media/media-button/media-ai-button.js b/projects/plugins/jetpack/extensions/shared/external-media/media-button/media-ai-button.js index b2421d0587c0b..765f2f77a63e5 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/media-button/media-ai-button.js +++ b/projects/plugins/jetpack/extensions/shared/external-media/media-button/media-ai-button.js @@ -6,7 +6,8 @@ function MediaAiButton( props ) { const { setSelectedSource } = props; return (