-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[Image with Text] Add ambient movement to image #2385
Changes from 1 commit
b15da1a
5fb7ea5
fd8b916
e315fc6
42de032
458401d
518055d
af63ab7
624ff4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,20 +18,29 @@ | |
<div class="image-with-text__grid grid grid--gapless grid--1-col grid--{% if section.settings.desktop_image_width == 'medium' %}2-col-tablet{% else %}3-col-tablet{% endif %}{% if section.settings.layout == 'text_first' %} image-with-text__grid--reverse{% endif %}"> | ||
<div class="image-with-text__media-item image-with-text__media-item--{{ section.settings.desktop_image_width }} image-with-text__media-item--{{ section.settings.desktop_content_position }} grid__item"> | ||
<div | ||
class="image-with-text__media image-with-text__media--{{ section.settings.height }} gradient color-{{ section.settings.color_scheme }} global-media-settings {% if section.settings.image != blank %}media{% else %}image-with-text__media--placeholder placeholder{% endif %}" | ||
class="image-with-text__media image-with-text__media--{{ section.settings.height }} gradient color-{{ section.settings.color_scheme }} global-media-settings {% if section.settings.image != blank %}media{% else %}image-with-text__media--placeholder placeholder{% endif %}{% if section.settings.image_behavior != 'none' %} animate--{{ section.settings.image_behavior }}{% endif %}" | ||
{% if section.settings.height == 'adapt' and section.settings.image != blank %} | ||
style="padding-bottom: {{ 1 | divided_by: section.settings.image.aspect_ratio | times: 100 }}%;" | ||
{% endif %} | ||
> | ||
{%- if section.settings.image != blank -%} | ||
{%- 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) | ||
{%- endcapture -%} | ||
{%- if section.settings.image_behavior == 'ambient' -%} | ||
{%- assign widths = '198, 432, 642, 900, 1284, 1800' -%} | ||
{%- capture sizes -%} | ||
(min-width: {{ settings.page_width }}px) {{ settings.page_width | minus: 100 | divided_by: 1.6667 }}px, | ||
(min-width: 750px) calc((100vw - 130px) / 1.667), calc((100vw - 50px) / 1.667) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is easier to read 😅 I'm switching it in my PR for collage's ambient movement |
||
{%- endcapture -%} | ||
{%- else -%} | ||
{%- assign widths = '165, 360, 535, 750, 1070, 1500' -%} | ||
{%- 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) | ||
{%- endcapture -%} | ||
{%- endif -%} | ||
{{ | ||
section.settings.image | ||
| image_url: width: 1500 | ||
| image_tag: loading: 'lazy', sizes: sizes, widths: '165, 360, 535, 750, 1070, 1500' | ||
| image_tag: loading: 'lazy', sizes: sizes, widths: widths | ||
}} | ||
{%- else -%} | ||
{{ 'image' | placeholder_svg_tag: 'placeholder-svg' }} | ||
|
@@ -243,6 +252,26 @@ | |
"default": "background-1", | ||
"label": "t:sections.all.colors.label" | ||
}, | ||
{ | ||
"type": "header", | ||
"content": "t:sections.image-with-text.settings.animations.content" | ||
}, | ||
{ | ||
"type": "select", | ||
"id": "image_behavior", | ||
"options": [ | ||
{ | ||
"value": "none", | ||
"label": "t:sections.image-with-text.settings.image_behavior.options__1.label" | ||
}, | ||
{ | ||
"value": "ambient", | ||
"label": "t:sections.image-with-text.settings.image_behavior.options__2.label" | ||
} | ||
], | ||
"default": "none", | ||
"label": "t:sections.image-with-text.settings.image_behavior.label" | ||
}, | ||
{ | ||
"type": "header", | ||
"content": "Mobile layout" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As noted in #2383 (comment), it might make sense to have these strings be global since they're re-used across a few Sections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting that after conferring with @kmeleta, I've updated this to use new strings declared in
sections.all.animation
(Commits 5fb7ea5 and fd8b916). We'll be using these for Image Banner, Image with Text, and Slideshow, so this cuts down on duplicate code.The only new consideration here is just that we should focus on merging this before #2383, since that PR will also need to use these global strings.