-
Notifications
You must be signed in to change notification settings - Fork 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
Pattern Assembler - Fast preview component max-height: 2000px cuts off patterns in tablet viewport #72364
Pattern Assembler - Fast preview component max-height: 2000px cuts off patterns in tablet viewport #72364
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Async-loaded Components (~208 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
@autumnfjeld I'm going to merge this PR because the issue exists in production now. |
I think your changes are definitely good. I tested in production and it is much better. :) I do wonder if we should allow the thumbnail to be a height greater than 500px. It’s not really possible to convey that “this pattern will fill your screen”. But maybe it should be taller than 500px? The reason I say that is to give a better “impression” that the pattern is “very tall” 🙂. I’m fine with leaving it how it is however. Just wanted to say my two thoughts. I mentioned that in a comment. |
…f patterns in tablet viewport (#72364) * Allow overwrite block renderer maxHeight * Disable maxHeight in large preview * Use viewport height for previewing 100vh patterns or limit to 500px instead of 2000px
maxHeight: | ||
maxHeight !== 'none' && ( contentHeight as number ) > maxHeight | ||
? ( maxHeight as number ) * scale | ||
: undefined, |
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.
Hey @miksansegundo, I noticed this while working on #74540. What are the units for maxHeight here? One issue I noticed is that maxHeight
can technically be a string (e.g. "200px"), which probably wouldn't work with this logic. (But it doesn't seem like we use it like that anywhere.)
But the main issue is that the types are technically wrong, since we now allow maxHeight
to be a string or a number. If we only want to allow "none", could we change it so that the prop type is "none" | number
?
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 ping @noahtallen, the units for maxHeight
are pixels
and the type is number
. I added the type string
only to support disabling the default value using none
.
I'll change the type to use 'none' | number
for now and follow up with a better way to disable the default value via a new prop. See #74843
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.
Cool!
Proposed Changes
maxHeight
maxHeight
in the large preview100vh
patterns to500px
instead of2000px
or use the viewport height if it's passedThis solution fixes the pattern cut-off issue in the large preview while still supporting
viewportHeight
for patterns with100vh
and sets a height of500px
for their thumbnail preview, which looks better than2000px
.Thumbnail for 100vh patterns
Large preview for patterns that create viewport scroll
Testing Instructions
Start designing
tablet
viewport, and the scroll should appear because the pattern height is tallerPre-merge Checklist
Related to #72313 #70063