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

[Templates] Animate blog, blog post, page, and collection templates #2533

Merged
merged 8 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions sections/main-article.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
</div>
{%- when 'featured_image' -%}
{%- if article.image -%}
<div class="article-template__hero-container" {{ block.shopify_attributes }}>
<div
class="article-template__hero-container{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--fade-in{% endif %}"
{{ block.shopify_attributes }}
>
<div
class="article-template__hero-{{ block.settings.image_height }} media"
itemprop="image"
Expand Down Expand Up @@ -40,8 +43,16 @@
{%- endif -%}

{%- when 'title' -%}
<header class="page-width page-width--narrow" {{ block.shopify_attributes }}>
<h1 class="article-template__title" itemprop="headline">{{ article.title | escape }}</h1>
<header
class="page-width page-width--narrow{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--fade-in{% endif %}"
{{ block.shopify_attributes }}
>
<h1
class="article-template__title"
itemprop="headline"
>
{{ article.title | escape }}
</h1>
{%- if block.settings.blog_show_date -%}
<span class="circle-divider caption-with-letter-spacing" itemprop="dateCreated pubdate datePublished">
{{- article.published_at | time_tag: format: 'date' -}}
Expand All @@ -56,30 +67,36 @@

{%- when 'content' -%}
<div
class="article-template__content page-width page-width--narrow rte"
class="article-template__content page-width page-width--narrow rte{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--slide-in{% endif %}"
itemprop="articleBody"
{{ block.shopify_attributes }}
>
{{ article.content }}
</div>

{%- when 'share' -%}
<div class="article-template__social-sharing page-width page-width--narrow" {{ block.shopify_attributes }}>
<div
class="article-template__social-sharing page-width page-width--narrow{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--slide-in{% endif %}"
{{ block.shopify_attributes }}
>
{% assign share_url = request.origin | append: article.url %}
{% render 'share-button', block: block, share_link: share_url %}
</div>
{%- endcase -%}
{%- endfor -%}

<div class="article-template__back element-margin-top center">
<div class="article-template__back element-margin-top center{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--slide-in{% endif %}">
<a href="{{ blog.url }}" class="article-template__link link animate-arrow">
<span class="icon-wrap">{% render 'icon-arrow' %}</span>
{{ 'blogs.article.back_to_blog' | t: title: blog.title }}
</a>
</div>
{%- if blog.comments_enabled? -%}
<div class="article-template__comment-wrapper background-secondary">
<div id="comments" class="page-width page-width--narrow">
<div
id="comments"
class="page-width page-width--narrow{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--slide-in{% endif %}"
>
ludoboludo marked this conversation as resolved.
Show resolved Hide resolved
{%- if article.comments_count > 0 -%}
{%- assign anchorId = '#Comments-' | append: article.id -%}

Expand Down
12 changes: 10 additions & 2 deletions sections/main-blog.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@

{%- paginate blog.articles by 6 -%}
<div class="main-blog page-width section-{{ section.id }}-padding">
<h1 class="title--primary">{{ blog.title | escape }}</h1>
<h1 class="title--primary{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--fade-in{% endif %}">
{{ blog.title | escape }}
</h1>

<div class="blog-articles {% if section.settings.layout == 'collage' %}blog-articles--collage{% endif %}">
{%- for article in blog.articles -%}
<div class="blog-articles__article article">
<div
class="blog-articles__article article{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--slide-in{% endif %}"
{% if settings.animations_reveal_on_scroll %}
data-cascade
style="--animation-order: {{ forloop.index }};"
{% endif %}
>
{%- render 'article-card',
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing that isn't animated in here is the pagination. There is maybe an issue to add it to it 🤔
I think in some cases we're animating the container like in the comments for main-article.liquid.

article: article,
media_height: section.settings.image_height,
Expand Down
2 changes: 1 addition & 1 deletion sections/main-collection-banner.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{%- endstyle -%}

<div class="collection-hero{% if section.settings.show_collection_image and collection.image %} collection-hero--with-image{% endif %} color-{{ section.settings.color_scheme }} gradient">
<div class="collection-hero__inner page-width">
<div class="collection-hero__inner page-width {% if settings.animations_reveal_on_scroll %} scroll-trigger animate--fade-in{% endif %}">
Copy link
Contributor

@ludoboludo ludoboludo Apr 14, 2023

Choose a reason for hiding this comment

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

Similar question here. Should we consider doing a slide in on the collection-hero__text-wrapper that contains the title and description and then fade-in for the collection-hero__image-container 🤔

<div class="collection-hero__text-wrapper">
<h1 class="collection-hero__title">
<span class="visually-hidden">{{ 'sections.collection_template.title' | t }}: </span>
Expand Down
12 changes: 10 additions & 2 deletions sections/main-list-collections.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
{{ 'section-collection-list.css' | asset_url | stylesheet_tag }}

<div class="page-width">
<h1 class="title title--primary inline-richtext">{{ section.settings.title }}</h1>
<h1 class="title title--primary inline-richtext{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--fade-in{% endif %}">
{{ section.settings.title }}
</h1>
{%- liquid
case section.settings.sort
when 'products_high', 'products_low'
Expand All @@ -27,7 +29,13 @@
role="list"
>
{%- for collection in collections -%}
<li class="collection-list__item grid__item">
<li
class="collection-list__item grid__item{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--slide-in{% endif %}"
{% if settings.animations_reveal_on_scroll %}
data-cascade
style="--animation-order: {{ forloop.index }};"
{% endif %}
>
{% render 'card-collection',
card_collection: collection,
media_aspect_ratio: section.settings.image_ratio,
Expand Down
4 changes: 2 additions & 2 deletions sections/main-page.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
{%- endstyle -%}

<div class="page-width page-width--narrow section-{{ section.id }}-padding">
<h1 class="main-page-title page-title h0">
<h1 class="main-page-title page-title h0{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--fade-in{% endif %}">
{{ page.title | escape }}
</h1>
<div class="rte">
<div class="rte{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--slide-in{% endif %}">
{{ page.content }}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion snippets/facets.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
endif
-%}

<div class="facets-container{% if filter_type == 'drawer' %} facets-container-drawer{% endif %}">
<div class="facets-container{% if filter_type == 'drawer' %} facets-container-drawer{% endif %}{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--fade-in{% endif %}">
{%- if filter_type == 'vertical' or filter_type == 'horizontal' -%}
<facet-filters-form class="facets small-hide">
<form
Expand Down