-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix site logo unresized size take 2 #30846
Conversation
Size Change: +1.86 kB (0%) Total Size: 1.46 MB
ℹ️ View Unchanged
|
@@ -337,6 +337,7 @@ export default function LogoEdit( { | |||
); | |||
|
|||
const classes = classnames( className, { | |||
'is-default-size': ! width, | |||
'is-resized': !! width, |
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.
Do we still need this then? Seems like there's only one occurence left here:
gutenberg/packages/block-library/src/site-logo/editor.scss
Lines 13 to 15 in 82ddc9e
&.is-resized { | |
display: table; | |
} |
...which we could probably replace with a &:not(.is-default-size)
?
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.
The is-resized rule, and the table display, was present before the changes I made to default sizes, and I believe are still necessary. I'd prefer to not touch them, or at least touch them separately if need be.
I suspect they were ported over when the block was copied from its Image block roots, and in the image block the table property is used to size the image the same as the caption when manually sized. But I'd still like to fix that separately.
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.
Oh, I didn't mean to remove the rule entirely, but rather to change its selector to &:not(.is-default-size)
so we can drop the now-redundant is-resized
className 😄
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.
(If we can't do that, I think I'd prefer #30845, since it doesn't introduce another class name that is essentially just is-resized
negated, which is kinda redundant.)
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.
Oh of course! I'll get on it. Can I have 20 minutes? I have to pick up a kid very quick
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.
Sure! 😄
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.
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.
Thanks for the fix! This seems to work overall. One thing I've noticed however is that for the _un_resized Site Logo, the aspect ratio isn't preserved on the frontend for me (this is with TT1 Blocks v0.4.5) -- which looks pretty weird for big images, since they're shrunk to 120px wide, but retain their original height.
Any chance we can fix that too? 😅
I added height auto, which of course should be there if the width is set. Thank you! |
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.
Looking great now! Thanks again!
Add a new "is-default-size" class, and attach the 120px width to it.
Cherry-picked to |
Description
Alternative to #30845. This one adds a new "is-default-size" class, to which it attaches the 120px width.
How has this been tested?
Insert a site logo block. Add a big image. Duplicate the block
One of the blocks you resize, the other you leave alone. Editor and frontend should look the same.
Checklist:
*.native.js
files for terms that need renaming or removal).