{ controls }
{ !! logoUrl && logoImage }
{ ! logoUrl && ! canUserEdit && (
-
+
{ isLoading && (
@@ -452,25 +480,25 @@ export default function LogoEdit( {
) }
{ ! logoUrl && canUserEdit && (
}
- labels={ {
- title: label,
- instructions: __(
- 'Upload an image, or pick one from your media library, to be your site logo'
- ),
- } }
onSelect={ onSelectLogo }
accept={ ACCEPT_MEDIA_STRING }
allowedTypes={ ALLOWED_MEDIA_TYPES }
- mediaPreview={ logoImage }
- notices={
- error && (
-
- { error }
-
- )
- }
onError={ onUploadError }
+ placeholder={ placeholder }
+ mediaLibraryButton={ ( { open } ) => {
+ return (
+
diff --git a/packages/block-library/src/site-logo/editor.scss b/packages/block-library/src/site-logo/editor.scss
index 6c420268aa36b7..cfde7320f91722 100644
--- a/packages/block-library/src/site-logo/editor.scss
+++ b/packages/block-library/src/site-logo/editor.scss
@@ -24,7 +24,6 @@
}
}
-
.custom-logo-link {
cursor: inherit;
@@ -42,24 +41,36 @@
height: auto;
max-width: 100%;
}
+}
- // Placeholder improvements.
- .components-placeholder {
- justify-content: flex-start;
- min-height: auto;
+// Provide special styling for the placeholder.
+.wp-block-site-logo.wp-block-site-logo {
+ // Inherit border radius from style variations.
+ .components-placeholder,
+ .components-resizable-box__container {
+ border-radius: inherit;
+ }
+
+ // Match the default logo size.
+ &.is-default-size .components-placeholder {
height: 120px;
- padding: $grid-unit-15;
+ width: 120px;
+ }
- // Massage the label.
- .components-placeholder__label {
- margin-top: $grid-unit-15;
- white-space: nowrap;
- }
+ .components-placeholder {
+ justify-content: center;
+ align-items: center;
+ box-shadow: none;
+ padding: 0;
- .components-placeholder__label .block-editor-block-icon,
- .components-placeholder__label > svg {
- margin-right: $grid-unit-05;
- }
+ // Provide a minimum size for the placeholder, for when the logo is resized.
+ // @todo: resizing is currently only possible by adding an image, resizing,
+ // and then removing the image again. We might want to enable resizing on the
+ // placeholder itself.
+ min-height: $grid-unit-60;
+ min-width: $grid-unit-60;
+ height: 100%;
+ width: 100%;
// Hide the upload button, as it's also available in the media library.
.components-form-file-upload {
@@ -79,9 +90,80 @@
justify-content: center;
}
- // Hide drag and drop text.
+ // Hide items.
.components-drop-zone__content-text {
display: none;
}
+
+ // Draw the dashed outline.
+ // By setting the dashed border to currentColor, we ensure it's visible
+ // against any background color.
+ color: currentColor;
+ &::before {
+ content: "";
+ display: block;
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ border: $border-width dashed currentColor;
+ opacity: 0.3;
+ pointer-events: none;
+
+ // Inherit border radius from style variations.
+ border-radius: inherit;
+ }
+
+ // Style the upload button.
+ .components-placeholder__fieldset {
+ width: auto;
+ }
+
+ .components-button.components-button {
+ color: inherit;
+ padding: 0;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ width: $grid-unit-60;
+ height: $grid-unit-60;
+ border-radius: 50%;
+ position: relative;
+ visibility: hidden;
+
+ // Animation.
+ background: transparent;
+ transition: all 0.1s linear;
+ @include reduce-motion("transition");
+ }
+
+ .components-button.components-button > svg {
+ color: $white;
+ }
+
+ // Style the placeholder illustration.
+ .components-placeholder__illustration {
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ stroke: currentColor;
+ stroke-dasharray: 3;
+ opacity: 0.3;
+ }
+ }
+
+ // Show upload button on block selection.
+ &.is-selected .components-button.components-button {
+ background: var(--wp-admin-theme-color);
+ border-color: var(--wp-admin-theme-color);
+ border-style: solid;
+ color: $white;
+ opacity: 1;
+ visibility: visible;
}
}
diff --git a/packages/block-library/src/site-logo/style.scss b/packages/block-library/src/site-logo/style.scss
index dd8a883238f56c..00dc6b44efe9ad 100644
--- a/packages/block-library/src/site-logo/style.scss
+++ b/packages/block-library/src/site-logo/style.scss
@@ -11,12 +11,18 @@
height: auto;
}
+ // Inherit border radius from style variations.
+ a,
+ img {
+ border-radius: inherit;
+ }
+
.aligncenter {
display: table;
}
// Style variations
- &.is-style-rounded img {
+ &.is-style-rounded {
// We use an absolute pixel to prevent the oval shape that a value of 50% would give
// to rectangular images. A pill-shape is better than otherwise.
border-radius: 9999px;
diff --git a/packages/components/src/drop-zone/style.scss b/packages/components/src/drop-zone/style.scss
index 012edd3ce8bed9..a289d963a86fcc 100644
--- a/packages/components/src/drop-zone/style.scss
+++ b/packages/components/src/drop-zone/style.scss
@@ -51,6 +51,7 @@
margin: 0 auto;
line-height: 0;
fill: currentColor;
+ pointer-events: none;
}