-
Notifications
You must be signed in to change notification settings - Fork 166
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 aspect ratio in image container component on smaller screens #5179
Fix aspect ratio in image container component on smaller screens #5179
Conversation
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.
Clever! It seems to me there are two big gotchas with this approach that we should consider:
- It won't work at all for full-bleed images; we'll either need an entirely new component or to use Modifiers to alter its approach significantly
- It relies on the images being presented fitting within a specific range of dimensions; particularly wide or tall images could be problematic
If we're comfortable with these compromises, I think it works.
Adapted from: https://nikitahl.com/css-aspect-ratio |
Demos.haus did not automatically build last week due to some IS issues, but my push to resolve version # merge conflict just now seems to have triggered a demos.haus build successfully without posting the demo link to this PR. Demo is at https://vanilla-framework-5179.demos.haus/ |
looks like they are not using the correct colour. Shouild be the low-contrast one. |
@lyubomir-popov |
53ed701
to
8023d09
Compare
@pastelcyborg Can you please link your codepen here and talk a bit about pros/cons comparing these approaches? |
@bartaz Can you please write a bit here about your alternative approach with applying the aspect ratio on parent & image and then using the image macro to specify metrics? |
LGTM! |
@jmuzina @pastelcyborg I may have found a cleaner solution. First, switched to Haven't found any issues with this approach yet. |
This reverts commit 8023d09.
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.
@bartaz GH won't let me approve this as it's originally my PR, but this looks good !
Running a Percy check manually using Percy label as this was modified by Bartek before the Percy label bug (#5188 ) was fixed Edit: Percy build created, and has expected changes :) |
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.
on behalf of @jmuzina
…onical#5179) * Fix aspect ratio utility on smaller screens * Functionalize aspect ratio calculation & better document it * Update _patterns_image.scss update documentation to be more clear * patch version bump for aspect ratio fix * Switching to flexbox with image contained * Revert "patch version bump for aspect ratio fix" This reverts commit 8023d09. --------- Co-authored-by: Bartek Szopka <bartek.szopka@canonical.com>
Done
Fixes image container aspect ratio not being respected on smaller displays.
Fixes #5159
QA
Check if PR is ready for release
If this PR contains Vanilla SCSS code changes, it should contain the following changes to make sure it's ready for the release:
Feature 🎁
,Breaking Change 💣
,Bug 🐛
,Documentation 📝
,Maintenance 🔨
.package.json
should be updated relative to the most recent release, following semver convention:Screenshots