-
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
Add new image container component and deprecate legacy image variants #5097
Conversation
hi - I think we can drop |
As @lyubomir-popov mentioned, |
Adjusted this to use the class name you described and switched to While it is syntactically possible for us to use This causes a linting failure due to our linter configuration. @bartaz @pastelcyborg What do you think is the most semantically clear way to name this class? I don't think we should alter our linting rules for this. Perhaps |
I still think we should not introduce them as utilities if they are meant for images only. Utilities should be a last resort class name that clearly can be applied in ANY context. These from their description seem like are designed to be used with images and images only. Our current image styling is quite dated (we probably don't want to use the Creating those image-only class names as utilities is a bad precence in my opition. @lyubomir-popov What kind of images styles do we need to support? I see we have images that cover all available space, and illustrations that have some kind of highlight background around them. Any other "background" styles? The other variable is aspect ratio that is quite well defined. Is there anything else about images we want to control? How I see it is that we could possibly have some kind of So something like:
|
Ditto @bartaz comment about them not being utility classes. As a general rule, I believe we should be rigorously vetting anything proposed as a utility class, keeping as much as possible associated with specific components. Too many utilities tends to lead to wide-scale scope creep and a lack of focus in a design system. Another thought: I don't love that the demonstrated use cases showcase the image being squashed and stretched, and it's making me wonder if this is how we really want aspect ratios to be implemented. Usually images are provided from design already in their desired aspect ratio, and manipulating their width/height metrics via CSS independently (i.e. not locked to one another) is not desired. What are we actually trying to achieve with this new functionality? It seems like a container with an aspect ratio (often implemented in CSS via padding-top percentages) and some form of |
Thanks for making these changes. I'm wondering if we should change the examples to make it a bit easier to tell what each of them is actually doing; because the image used is so small and there's no background color or border, it's kind of difficult to understand the aspect ratio being applied, since the examples all kind of just look like a big white frame. Even just making the example embed smaller (particularly horizontally) might help here. |
3b67544
to
08291b8
Compare
@bartaz @pastelcyborg I have made the requested change to use |
@pastelcyborg I will revise this so the aspect ratio examples use an image with a background or border. The background highlight image will remain the same however as that background-less image is the intended use case for the background highlight. |
templates/docs/examples/patterns/image/container/aspect-ratio/16-9.html
Outdated
Show resolved
Hide resolved
|
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.
This all looks good to me at this point, unless @bartaz has any additional thoughts.
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.
Small tweaks to release notes
templates/docs/examples/patterns/image/container/highlighted.html
Outdated
Show resolved
Hide resolved
templates/docs/patterns/images.md
Outdated
All image containers center the `.p-image-container__image` element inside them by default. | ||
If you need to change image alignment within the image container, use the [image position utility](/docs/utilities/image-position). | ||
|
||
| CSS Class | Aspect ratio | |
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.
That reminded me that we actually have a feature to generate list of component class names from the code comment, like this: https://vanillaframework.io/docs/base/code#class-reference
Maybe it would be relatively simple to add something like that to image container? It's basically a yaml at the beginning of the scss file:
https://github.com/canonical/vanilla-framework/blob/main/scss/_patterns_code-snippet.scss#L1-L45
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.
Revised to use class reference for classname documentation
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
scss/_patterns_image.scss
Outdated
Image: | ||
.p-image-container__image: | ||
Image element within an image container. | ||
Bordered (deprecated): |
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.
Let's not talk about the deprecated ones, less stuff to remove later.
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 all the updates and discussions, all looks good!
Done
Added several classes that will help unify the appearance of images in projects that use Vanilla, and deprecated some styles that are no longer part of branding.
p-image-container--
classes for setting element aspect ratio.p-image-container--16-9
p-image-container--3-2
p-image-container--2-3
p-image-container--cinematic
p-image-container--square
p-image-container .is-highlighted
for distinguishing an image from its surroundings by applying a slight underlay.p-image--bordered
andp-image--shadowed
Closes: #4876 WD-11412
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
Background highlight:
Aspect ratio: