bolt
bolt copied to clipboard
DS-767 Remove usage of image component from card
Jira
https://pegadigitalit.atlassian.net/browse/DS-767
Summary
Support for image element was added.
Details
- Support for the
Image Element
is added, - Backwards compatibility with the
Image Component
-
Card
schema was updated to point to theImage Element
instead of theImage Component
, -
Image Component
props were replaced withImage Element
props in the pattern lab
How to test
Pull the branch. Check if by passing arguments in the Card component to the media: { image: { ...
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image alt.',
},
},
renders the image element instead of the <bolt-image/>
component
Release notes
When adding arguments in the Card for image rendering please refer to the Image Element
schema options instead of Image Component
@MarcinMr disregard the previous comment, for some reason when i pulled the branch it was out of date. Everything is looking correct now.
@remydenton
Thanks for explaining, this was my misunderstood. I updated the template and PL files.
I have one more question regarding _card-replacement-media.twig
On line 16 we check if the Card component has horizontal
prop and then we update the props with the ratio
and cover
(this is for the deprecated).
On line 24 I tried to do the same for the image-element
, Whenever the horizontal
prop is true
I wanted to update the image element with the prop background: true
(needed for cropping Image Element when horizontal card is used)
But the terminal throws an error:
Seems like I can't use the merge filter on that object?
So whenever we want horizontal cards with image elements we need to add background: true
to the image element include:
{% include '@bolt-elements-image/image.twig' with {
background: true,
attributes: {
...
},
} only %}
Is there a way to do it in the template? Or adding the background
prop directly to the image-element include is ok?
@remydenton thanks for explaining. I updated the docs and the pattern lab, so right now there shouldn't be more examples like this:
media: {
image: {
src: '/path/to/image,
Looking really good, just one final comment/question on the wording in the docs.