-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Update site editor block placeholder styling #35513
Changes from 3 commits
33c960c
0b7a014
32e3f01
a76a286
d3baa94
9c0b90e
dc8a095
ea8173f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ | |
|
||
.wp-block-post-author__name { | ||
margin: 0; | ||
font-weight: bold; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize this PR is not about the Post Author block. But seeing just this one font weight removed makes me wonder: why are there so many rules just for the editor view of the post author block? It seems like it would cause a lot of divergence. Any thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's because the Post Author block currently also includes an option to display the author avatar, bio, and a byline (I'm not entirely sure where the byline comes from 😬). These should all be separate blocks, but that is clearly another issue :D There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fine, whether one or multiple. My question is rather, why are these styles stored in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see. Yes that does seem odd. I'll see if I can tidy it up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, it doesn't have to be this PR, or you — I mostly noticed it because you tweaked the font weight, making me wonder: why just the font weight? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turns out we don't need the editor-specific styles for the Post Author block at all. I think we can tidy these styles up even more when we split this in to separate blocks. |
||
} | ||
|
||
.wp-block-post-author__bio { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,9 +59,7 @@ export default function PostExcerptEditor( { | |
if ( ! postType || ! postId ) { | ||
return ( | ||
<div { ...blockProps }> | ||
<Warning> | ||
{ __( 'Post excerpt block: no post found.' ) } | ||
</Warning> | ||
{ __( 'Post excerpt block: no post found.' ) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this occurs when you're editing content in the site editor, and the content that you're editing has no excerpt, but the template attempts to display it. I just checked and it turns out this issue exists on trunk. I think it's a separate thing, so we can probably create a dedicated issue.
Totally, I was going to do the content stuff in a separate PR, but I suppose we could do it here. |
||
</div> | ||
); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,9 @@ | |
import { useEntityProp, store as coreStore } from '@wordpress/core-data'; | ||
import { useSelect } from '@wordpress/data'; | ||
import { | ||
Icon, | ||
ToggleControl, | ||
PanelBody, | ||
Placeholder, | ||
withNotices, | ||
} from '@wordpress/components'; | ||
import { | ||
|
@@ -19,6 +19,7 @@ import { | |
} from '@wordpress/block-editor'; | ||
import { __, sprintf } from '@wordpress/i18n'; | ||
import { postFeaturedImage } from '@wordpress/icons'; | ||
import { SVG, Path } from '@wordpress/primitives'; | ||
|
||
/** | ||
* Internal dependencies | ||
|
@@ -27,10 +28,21 @@ import DimensionControls from './dimension-controls'; | |
|
||
const ALLOWED_MEDIA_TYPES = [ 'image' ]; | ||
const placeholderChip = ( | ||
<div className="post-featured-image_placeholder"> | ||
<Icon icon={ postFeaturedImage } /> | ||
<p> { __( 'Featured Image' ) }</p> | ||
</div> | ||
<Placeholder className={ 'block-editor-media-placeholder' }> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm impressed you took this one on directly! I do think maybe this one might be better as a separate PR, as it's likely more of a mouthful than the first glance. For example, it's not looking too great in the post editor: There's a discussion on what role it serves in the post editor, but nevertheless it is there at the moment. I also think we'll either want to tweak the mountainrange illustration, or make it scale to fill the entire canvas rather than just be centered in the middle: |
||
{ | ||
<SVG | ||
className="components-placeholder__illustration" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
viewBox="0 0 60 60" | ||
> | ||
<Path | ||
vectorEffect="non-scaling-stroke" | ||
d="m61 32.622-13.555-9.137-15.888 9.859a5 5 0 0 1-5.386-.073l-9.095-5.989L1 37.5" | ||
/> | ||
</SVG> | ||
} | ||
</Placeholder> | ||
); | ||
|
||
function PostFeaturedImageDisplay( { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,29 +6,55 @@ div[data-type="core/post-featured-image"] { | |
} | ||
} | ||
|
||
.editor-styles-wrapper { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is really nice to get rid of, though. |
||
.post-featured-image_placeholder { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
border-radius: $radius-block-ui; | ||
background-color: $white; | ||
box-shadow: inset 0 0 0 $border-width $gray-900; | ||
padding: $grid-unit-15; | ||
svg { | ||
margin-right: $grid-unit-15; | ||
} | ||
p { | ||
font-family: $default-font; | ||
font-size: $default-font-size; | ||
margin: 0; | ||
} | ||
} | ||
} | ||
|
||
.block-library-post-featured-image-dimension-controls { | ||
margin-bottom: $grid-unit-10; | ||
&.scale-control-is-visible { | ||
margin-bottom: $grid-unit-20; | ||
} | ||
} | ||
.wp-block-post-featured-image { | ||
.components-placeholder { | ||
justify-content: center; | ||
align-items: center; | ||
box-shadow: none; | ||
padding: 0; | ||
|
||
// 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: $grid-unit * 30; | ||
width: 100%; | ||
|
||
&::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; | ||
} | ||
} | ||
|
||
.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; | ||
} | ||
} |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love that we can remove all of these single-purpose stylesheets.