Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish the Site Logo block. #30526

Merged
merged 4 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions packages/block-library/src/site-logo/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,14 @@ const SiteLogo = ( {
return (
<>
<InspectorControls>
<PanelBody title={ __( 'Site Logo Settings' ) }>
<PanelBody title={ __( 'Settings' ) }>
<RangeControl
label={ __( 'Image width' ) }
onChange={ ( newWidth ) =>
setAttributes( { width: newWidth } )
}
min={ minWidth }
max={ maxWidthBuffer }
initialPosition={ Math.min(
naturalWidth,
maxWidthBuffer
) }
value={ width || '' }
disabled={ ! isResizable }
/>
Expand Down
54 changes: 54 additions & 0 deletions packages/block-library/src/site-logo/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,25 @@
}

.wp-block-site-logo {
// Make the block selectable.
a {
pointer-events: none;
}

&.is-resized {
display: table;
}

// Provide a sane starting point for the size.
&:not(.is-resized) {
width: 120px;

img {
width: 100%;
}
}


.custom-logo-link {
cursor: inherit;

Expand All @@ -25,4 +40,43 @@
display: block;
max-width: 100%;
}

// Placeholder improvements.
.components-placeholder {
min-height: auto;
height: 120px;
padding: $grid-unit-10;

// Massage the label.
.components-placeholder__label {
white-space: nowrap;
}

.components-placeholder__label .block-editor-block-icon {
margin-right: $grid-unit-05;
}

// Hide the upload button, as it's also available in the media library.
.components-form-file-upload {
display: none;
}

// Position the spinner.
.components-placeholder__preview {
position: absolute;
top: $grid-unit-05;
right: $grid-unit-05;
bottom: $grid-unit-05;
left: $grid-unit-05;
background: rgba($white, 0.8);
display: flex;
align-items: center;
justify-content: center;
}

// Hide drag and drop text.
.components-drop-zone__content-text {
display: none;
}
}
}
2 changes: 1 addition & 1 deletion packages/block-library/src/site-logo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export { metadata, name };

export const settings = {
title: _x( 'Site Logo', 'block title' ),
description: __( 'Show a site logo' ),
description: __( 'Displays and enables editing of the site logo.' ),
icon,
styles: [
{
Expand Down
9 changes: 9 additions & 0 deletions packages/block-library/src/site-logo/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
.wp-block-site-logo {
line-height: 0;

a {
display: inline-block;
}

// Provide a sane starting point for the size.
&:not(.is-resized) img {
width: 120px;
}

.aligncenter {
display: table;
}
Expand Down