Skip to content
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

feat(picture): add picture component - FRONT-3868 #2789

Merged
merged 3 commits into from
Mar 6, 2023

Conversation

emeryro
Copy link
Contributor

@emeryro emeryro commented Mar 6, 2023

Add component to handle the display of images by using the html picture tag

@github-actions
Copy link

github-actions bot commented Mar 6, 2023

...
]
- "picture_class" (optional) (string) (default: '')
- "image_class" (optional) (string) (default: '')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our templates have extra_classes and extra_attributes by "default" forthe root element, why aren't we using them here..?

<source srcset="{{ _source.src|default('') }}" media="{{ _source.media|default('') }}" type="{{ _source.type|default('') }}">
{% endfor %}
{% endif %}
<img class="{{ _image_class }}" src="{{ _picture.img.src|default('') }}" alt="{{ _picture.img.alt|default('') }}" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we should add some checks here before rendering stuff, all these attributes might not have any value and we would render them empty.
It also feels that this data structure gets too structured in order to have a single object, the img object is nested into the picture one, but ok let's keep it like this.

@planctus planctus merged commit a95e781 into v3.8.0-dev Mar 6, 2023
@planctus planctus deleted the FRONT-3868-picture branch March 6, 2023 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants