Skip to content

Commit 75ffd10

Browse files
committed
fix: update image component to use new ratio object params for specifying height and width aspect ratios
1 parent 8dfe3f3 commit 75ffd10

File tree

1 file changed

+4
-7
lines changed
  • src/_patterns/02-components/bolt-image/src

1 file changed

+4
-7
lines changed

src/_patterns/02-components/bolt-image/src/image.twig

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@
9494
{% endif %}
9595

9696
{% set attributes = create_attribute(attributes | default({})).addClass('c-bolt-image') %}
97-
{% set styles = attributes.getAttribute('style') | split(' ') | merge([
98-
"padding-top: #{ratio};"
99-
]) %}
100-
{% set attributes = attributes.setAttribute('style', styles | join(' ')) %}
101-
10297

10398
{% set imageAttributes = create_attribute(imageAttributes | default({})).addClass([
10499
"c-bolt-image__img",
@@ -147,9 +142,11 @@
147142
{% endset %}
148143
<bolt-image>
149144
{% block image_content %}
150-
{% if ratio == true %}
145+
{% if width > 0 and height > 0 and ratio == true %}
151146
{% embed "@bolt/ratio.twig" with {
152-
attributes: attributes
147+
attributes: attributes,
148+
aspectRatioHeight: height * 1,
149+
aspectRatioWidth: width * 1
153150
} %}
154151
{% block ratio_content %}
155152
{{ ext == "jpg" ? imagePlaceholder : "" }}

0 commit comments

Comments
 (0)