-
Notifications
You must be signed in to change notification settings - Fork 144
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
Add image size properties to the infoCard component #1126
base: master
Are you sure you want to change the base?
Conversation
Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖 Please select which version do you want to release:
And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.
|
Beep boop 🤖 Thank you so much for keeping our documentation up-to-date ❤️ |
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.
Separe the property for different layouts (desktop and mobile)
Hi @efremov-av! The |
| `imageHeight` | `number` | Height of the image that is used to improve CLS while the image is loading. | `null` | | ||
| `imageWidth` | `number` | Width of the image that is used to improve CLS while the image is loading. | `null` | |
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.
| `imageHeight` | `number` | Height of the image that is used to improve CLS while the image is loading. | `null` | | |
| `imageWidth` | `number` | Width of the image that is used to improve CLS while the image is loading. | `null` | | |
| `imageHeight` | `number` | Height of the image used to improve [Cumulative Layout Shift (CLS)](https://web.dev/articles/cls) while the image loads. | `null` | | |
| `imageWidth` | `number` | Width of the image used to improve [Cumulative Layout Shift (CLS)](https://web.dev/articles/cls) while the image loads. | `null` | |
What problem is this solving?
There is a problem with page loading that affects the Core Web Vitals CLS score. The size of image is
0
while the image in infoCard is loading because browser does not yet know about image parameters (width, height and aspectRatio). To prevent this behavior we can definewidth
andheight
parameters to the<img />
element. Browser will read them and calculateaspect-ratio
to reserve a proper space for image.How to test it?
I defined
imageHeight
andimageWidth
props to the last infocard that has "Give the gift of choice" title.Workspace
Screenshots or example usage: