Skip to content

Commit

Permalink
Fix improper image size for the collapsible content (#2507)
Browse files Browse the repository at this point in the history
* Fix improper image size for collapsible content

* Refactoring and renaming variables.

* Fix prettier issue.

* Minor refactor.
  • Loading branch information
eugenekasimov authored May 1, 2023
1 parent 1efa673 commit b7de2c2
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions sections/collapsible-content.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,26 @@
style="padding-bottom: {{ 1 | divided_by: section.settings.image.aspect_ratio | times: 100 }}%;"
{% endif %}
>
{%- liquid
assign padding_multiplier = 1
if section.settings.layout == 'section'
assign padding_multiplier = 2
endif
assign desktop_tablet_padding = 100 | times: padding_multiplier | append: 'px'
assign mobile_padding = 30 | times: padding_multiplier | append: 'px'
-%}
{%- capture sizes -%}
(min-width: {{ settings.page_width }}px) {{ settings.page_width | minus: 100 | divided_by: 2 }}px,
(min-width: 750px) calc((100vw - 130px) / 2), calc((100vw - 50px) / 2)
(min-width: {{ settings.page_width }}px) calc(({{ settings.page_width }}px - {{ desktop_tablet_padding }}) / 2),
(min-width: 750px) calc((100vw - {{ desktop_tablet_padding }}) / 2),
calc(100vw - {{ mobile_padding }})
{%- endcapture -%}
{{
section.settings.image
| image_url: width: 1500
| image_tag: loading: 'lazy', sizes: sizes, widths: '165, 360, 535, 750, 1070, 1250, 1500'
| image_url: width: 3200
| image_tag:
loading: 'lazy',
sizes: sizes,
widths: '50, 75, 100, 150, 200, 300, 400, 500, 750, 1000, 1250, 1500, 1750, 2000, 2250, 2500, 2750, 3000, 3200'
}}
</div>
</div>
Expand Down

0 comments on commit b7de2c2

Please sign in to comment.