canonical / canonical/vanilla-framework
[support u-hide on image containers]: <Basic Section, image>
- Dominant language
- HTML
- Stars
- 983
- Forks
- 216
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 3
Description
## Component/pattern to amend
[Basic Section's image configuration](https://github.com/canonical/vanilla-framework/blob/c6b8c856396efcef7b41c55bbc31f0b5c26fefec/templates/_macros/vf_basic-section.jinja#L64-L65)
- Right now, there is no way to apply [hide utility classes](https://vanillaframework.io/docs/utilities/hide) when using the [Jinja template for images](https://vanillaframework.io/docs/patterns/basic-section#images)
- attrs can be passed to the image to hide it, but [these only apply to the image, not the containing block](https://github.com/canonical/vanilla-framework/blob/c6b8c856396efcef7b41c55bbc31f0b5c26fefec/templates/_macros/vf_basic-section.jinja#L64-L65), leaving a blank space on the page
## Visual
Undesirable functionality:
Desirable functionality:
## Context
There are several places across Canonical's websites where images are hidden on smaller display sizes. To implement this functionality, past users have relied on deprecated CTA section slots or broken out of the vanilla framework entirely. Some example pages with this feature include:
- [canonical.com/juju](https://canonical.com/juju) [[Source](https://github.com/canonical/canonical.com/blob/main/templates/juju/index.html#L87-L97)]: Hero image hides on medium and small devices
- [ubuntu.com/ceph/install](https://ubuntu.com/ceph/install) [[Source](https://github.com/canonical/ubuntu.com/blob/main/templates/ceph/install.html#L37-L47)]: Hero image hides on small devices
- [ubuntu.com/certified](https://ubuntu.com/certified) [[Source](https://github.com/canonical/ubuntu.com/blob/main/templates/certified/index.html#L420-L432)]: Decorative image hides on medium and small devices
It would be nice to be able to implement this functionality using non-deprecated Vanilla features.
Contributor guide
Research direction
Start in templates/_macros/vf_basic-section.jinja at the image configuration referenced by the issue, then review the hide utility documentation and the linked Basic Section image examples. Make the hide classes apply to the containing image block so hidden images do not leave blank space, and verify the existing image usage still renders correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, html
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100