quitar media print css
This commit is contained in:
+733
-31
@@ -1,47 +1,749 @@
|
||||
{% comment %}
|
||||
This section is used in the collection template to render collection page
|
||||
listing all products within a collection.
|
||||
{% liquid
|
||||
assign banner_type = collection.metafields.custom.banner_tipo.value | default: collection.metafields.custom.banner_type.value | downcase
|
||||
if banner_type == blank
|
||||
assign banner_type = 'titulo'
|
||||
endif
|
||||
|
||||
https://shopify.dev/docs/storefronts/themes/architecture/templates/collection
|
||||
{% endcomment %}
|
||||
assign banner_image = collection.metafields.custom.banner_imagen.value | default: collection.metafields.custom.banner_image.value
|
||||
if banner_image == blank
|
||||
assign banner_image = collection.image
|
||||
endif
|
||||
|
||||
<h1>{{ collection.title }}</h1>
|
||||
assign banner_title = collection.metafields.custom.banner_titulo.value | default: collection.metafields.custom.banner_title.value
|
||||
if banner_title == blank
|
||||
assign banner_title = collection.title
|
||||
endif
|
||||
|
||||
<div class="collection-products">
|
||||
{% paginate collection.products by 20 %}
|
||||
{% for product in collection.products %}
|
||||
<div class="collection-product">
|
||||
{% if product.featured_image %}
|
||||
{% render 'image',
|
||||
class: 'collection-product__image',
|
||||
image: product.featured_image,
|
||||
url: product.url,
|
||||
width: 400,
|
||||
height: 400,
|
||||
crop: 'center'
|
||||
%}
|
||||
{% endif %}
|
||||
<div class="collection-product__content">
|
||||
<p>{{ product.title | escape | link_to: product.url }}</p>
|
||||
<p>{{ product.price | money }}</p>
|
||||
assign banner_text = collection.metafields.custom.banner_texto.value | default: collection.metafields.custom.banner_text.value
|
||||
assign banner_text_is_html = false
|
||||
if banner_text == blank
|
||||
assign banner_text = collection.description
|
||||
assign banner_text_is_html = true
|
||||
endif
|
||||
|
||||
assign grid_image = collection.metafields.custom.banner_listado.value | default: collection.metafields.custom.banner_grid.value
|
||||
assign grid_link = collection.metafields.custom.banner_enlace.value | default: collection.metafields.custom.banner_link.value
|
||||
|
||||
assign show_hero = false
|
||||
assign show_grid_banner = false
|
||||
if banner_type == 'listado' or banner_type == 'grid' or banner_type == 'productos'
|
||||
assign show_grid_banner = true
|
||||
elsif banner_type == 'ambos' or banner_type == 'both'
|
||||
assign show_hero = true
|
||||
assign show_grid_banner = true
|
||||
else
|
||||
assign show_hero = true
|
||||
endif
|
||||
|
||||
if show_grid_banner and grid_image == blank
|
||||
assign grid_image = collection.metafields.custom.banner_imagen.value | default: collection.metafields.custom.banner_image.value
|
||||
endif
|
||||
if show_grid_banner and grid_image == blank
|
||||
assign show_grid_banner = false
|
||||
endif
|
||||
|
||||
assign per_page = section.settings.products_per_page | default: 9
|
||||
if show_grid_banner
|
||||
assign per_page = per_page | minus: 1
|
||||
endif
|
||||
if per_page < 1
|
||||
assign per_page = 1
|
||||
endif
|
||||
|
||||
assign current_sort = collection.sort_by | default: collection.default_sort_by
|
||||
assign sort_label = blank
|
||||
for option in collection.sort_options
|
||||
if option.value == current_sort
|
||||
assign sort_label = option.name
|
||||
endif
|
||||
endfor
|
||||
%}
|
||||
|
||||
<section
|
||||
class="collection full-width"
|
||||
data-collection
|
||||
data-cart-add-url="{{ routes.cart_add_url }}.js"
|
||||
>
|
||||
{% if show_hero %}
|
||||
<div class="collection__banner{% if banner_image == blank %} collection__banner--text{% endif %}">
|
||||
{% if banner_image != blank %}
|
||||
<div class="collection__banner-media">
|
||||
{{
|
||||
banner_image
|
||||
| image_url: width: 1600
|
||||
| image_tag:
|
||||
alt: banner_title,
|
||||
widths: '600, 960, 1400',
|
||||
sizes: '(max-width: 767px) 70vw, 50vw',
|
||||
class: 'collection__banner-image',
|
||||
loading: 'eager'
|
||||
}}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="collection__banner-copy">
|
||||
<h1 class="collection__banner-title">{{ banner_title | escape }}</h1>
|
||||
{% if banner_text != blank %}
|
||||
<div class="collection__banner-text">
|
||||
{% if banner_text_is_html %}
|
||||
{{ banner_text }}
|
||||
{% else %}
|
||||
{{ banner_text | escape | newline_to_br }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<img
|
||||
class="collection__banner-blob"
|
||||
src="{{ 'Capa_1.avif' | asset_url }}"
|
||||
alt=""
|
||||
width="185"
|
||||
height="210"
|
||||
>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<h1 class="collection__fallback-title">{{ collection.title | escape }}</h1>
|
||||
{% endif %}
|
||||
|
||||
{{ paginate | default_pagination }}
|
||||
{% endpaginate %}
|
||||
</div>
|
||||
<div class="collection__body">
|
||||
<div class="collection__bar">
|
||||
<div class="collection__tools">
|
||||
<button class="collection__tool" type="button" data-filter-toggle aria-expanded="false" aria-controls="collection-filters">
|
||||
<svg width="25" height="25" viewBox="0 0 25 25" aria-hidden="true" focusable="false">
|
||||
<path d="M4 7.5h17M4 12.5h17M4 17.5h17" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
|
||||
<circle cx="9" cy="7.5" r="2.1" fill="#f9f9fa" stroke="currentColor" stroke-width="1.4"/>
|
||||
<circle cx="16" cy="12.5" r="2.1" fill="#f9f9fa" stroke="currentColor" stroke-width="1.4"/>
|
||||
<circle cx="11" cy="17.5" r="2.1" fill="#f9f9fa" stroke="currentColor" stroke-width="1.4"/>
|
||||
</svg>
|
||||
{{ 'collection_page.filters' | t }}
|
||||
</button>
|
||||
<button class="collection__tool" type="button" data-sort-toggle aria-expanded="false" aria-controls="collection-sort">
|
||||
{{ 'collection_page.sort' | t: sort: sort_label }}
|
||||
</button>
|
||||
</div>
|
||||
<p class="collection__count">{{ 'collection_page.products' | t: count: collection.products_count }}</p>
|
||||
</div>
|
||||
|
||||
<div class="collection__panel" id="collection-filters" data-filter-panel>
|
||||
<div class="collection__panel-inner">
|
||||
{% if collection.filters.size > 0 %}
|
||||
<form class="collection__filter-form" action="{{ collection.url }}" method="get">
|
||||
{% if current_sort != blank %}
|
||||
<input type="hidden" name="sort_by" value="{{ current_sort }}">
|
||||
{% endif %}
|
||||
<div class="collection__filter-groups">
|
||||
{% for filter in collection.filters %}
|
||||
<fieldset class="collection__filter">
|
||||
<legend>{{ filter.label | escape }}</legend>
|
||||
{% case filter.type %}
|
||||
{% when 'price_range' %}
|
||||
<div class="collection__price">
|
||||
<input
|
||||
type="number"
|
||||
name="{{ filter.min_value.param_name }}"
|
||||
{% if filter.min_value.value %}value="{{ filter.min_value.value | divided_by: 100.0 }}"{% endif %}
|
||||
min="0"
|
||||
placeholder="0"
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
name="{{ filter.max_value.param_name }}"
|
||||
{% if filter.max_value.value %}value="{{ filter.max_value.value | divided_by: 100.0 }}"{% endif %}
|
||||
min="0"
|
||||
placeholder="{{ filter.range_max | divided_by: 100.0 }}"
|
||||
>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="collection__options">
|
||||
{% for value in filter.values %}
|
||||
<label class="collection__option">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="{{ value.param_name }}"
|
||||
value="{{ value.value }}"
|
||||
{% if value.active %}checked{% endif %}
|
||||
{% if value.count == 0 and value.active == false %}disabled{% endif %}
|
||||
>
|
||||
<span>{{ value.label | escape }} ({{ value.count }})</span>
|
||||
</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endcase %}
|
||||
</fieldset>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="collection__filter-actions">
|
||||
<button class="collection__apply" type="submit">{{ 'collection_page.apply' | t }}</button>
|
||||
<a class="collection__clear" href="{{ collection.url }}">{{ 'collection_page.clear' | t }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{% else %}
|
||||
<p class="collection__none">{{ 'collection_page.no_filters' | t }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="collection__panel" id="collection-sort" data-sort-panel>
|
||||
<div class="collection__panel-inner">
|
||||
<form class="collection__sort-form" action="{{ collection.url }}" method="get">
|
||||
{% for filter in collection.filters %}
|
||||
{% if filter.type == 'price_range' %}
|
||||
{% if filter.min_value.value %}
|
||||
<input type="hidden" name="{{ filter.min_value.param_name }}" value="{{ filter.min_value.value }}">
|
||||
{% endif %}
|
||||
{% if filter.max_value.value %}
|
||||
<input type="hidden" name="{{ filter.max_value.param_name }}" value="{{ filter.max_value.value }}">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% for value in filter.active_values %}
|
||||
<input type="hidden" name="{{ value.param_name }}" value="{{ value.value }}">
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="collection__sort-list">
|
||||
{% for option in collection.sort_options %}
|
||||
<button
|
||||
class="collection__sort-option{% if option.value == current_sort %} is-current{% endif %}"
|
||||
type="submit"
|
||||
name="sort_by"
|
||||
value="{{ option.value }}"
|
||||
>
|
||||
{{ option.name | escape }}
|
||||
</button>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% paginate collection.products by per_page %}
|
||||
{% if collection.products_count == 0 %}
|
||||
<p class="collection__empty">{{ 'collection_page.empty' | t }}</p>
|
||||
{% else %}
|
||||
<div class="collection__grid">
|
||||
{% if show_grid_banner %}
|
||||
{% if grid_link != blank %}
|
||||
<a class="collection__promo" href="{{ grid_link }}">
|
||||
{% else %}
|
||||
<div class="collection__promo">
|
||||
{% endif %}
|
||||
{{
|
||||
grid_image
|
||||
| image_url: width: 1200
|
||||
| image_tag:
|
||||
alt: banner_title,
|
||||
widths: '400, 700, 1000',
|
||||
sizes: '(max-width: 767px) 46vw, 33vw',
|
||||
loading: 'lazy'
|
||||
}}
|
||||
{% if grid_link != blank %}
|
||||
</a>
|
||||
{% else %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% for product in collection.products %}
|
||||
{% assign card_suffix = section.id | append: '-' | append: forloop.index %}
|
||||
{% render 'collection-card', product: product, form_suffix: card_suffix %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if paginate.pages > 1 %}
|
||||
<nav class="collection__pages" aria-label="{{ 'collection_page.page' | t: page: paginate.current_page }}">
|
||||
{% for part in paginate.parts %}
|
||||
{% if part.is_link %}
|
||||
<a class="collection__page" href="{{ part.url }}">{{ part.title }}</a>
|
||||
{% elsif part.title == paginate.current_page %}
|
||||
<span class="collection__page is-current" aria-current="page">{{ part.title }}</span>
|
||||
{% else %}
|
||||
<span class="collection__page collection__page--gap">{{ part.title }}</span>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if paginate.next %}
|
||||
<a class="collection__next" href="{{ paginate.next.url }}" aria-label="{{ 'collection_page.next_page' | t }}">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" aria-hidden="true" focusable="false">
|
||||
<path d="M7 4.5 12.5 10 7 15.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
{% endpaginate %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% stylesheet %}
|
||||
.collection-products {
|
||||
.collection {
|
||||
background: #f9f9fa;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.collection__banner {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
|
||||
grid-template-columns: 1fr 1fr;
|
||||
min-height: 380px;
|
||||
background: #f7c585;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.collection__banner--text {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.collection__banner-media {
|
||||
height: 100%;
|
||||
min-height: 380px;
|
||||
}
|
||||
|
||||
.collection__banner-image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 380px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.collection__banner-copy {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 22px;
|
||||
padding: 48px 180px 48px 70px;
|
||||
}
|
||||
|
||||
.collection__banner-title,
|
||||
.collection__fallback-title {
|
||||
margin: 0;
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.collection__fallback-title {
|
||||
padding: 40px 100px 0;
|
||||
}
|
||||
|
||||
.collection__banner-text {
|
||||
max-width: 570px;
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.collection__banner-text p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.collection__banner-blob {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 48px;
|
||||
width: 185px;
|
||||
height: auto;
|
||||
opacity: 0.8;
|
||||
pointer-events: none;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.collection__body {
|
||||
padding: 28px 100px 80px;
|
||||
}
|
||||
|
||||
.collection__bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.collection__tools {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.collection__tool {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
height: 50px;
|
||||
padding: 0 18px;
|
||||
border: 1px solid #808181;
|
||||
border-radius: 60px;
|
||||
background: transparent;
|
||||
color: #000;
|
||||
font: inherit;
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.collection__tool svg {
|
||||
display: block;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.collection__count,
|
||||
.collection__empty,
|
||||
.collection__none {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.collection__panel {
|
||||
display: grid;
|
||||
grid-template-rows: 0fr;
|
||||
transition: grid-template-rows 0.28s ease;
|
||||
}
|
||||
|
||||
.collection__panel.is-open {
|
||||
grid-template-rows: 1fr;
|
||||
}
|
||||
|
||||
.collection__panel-inner {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.collection__filter-form,
|
||||
.collection__sort-form {
|
||||
padding: 22px 0 8px;
|
||||
}
|
||||
|
||||
.collection__filter-groups {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 28px 48px;
|
||||
}
|
||||
|
||||
.collection__filter {
|
||||
min-width: 180px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.collection__filter legend {
|
||||
margin-bottom: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.collection__options {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.collection__option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 15px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.collection__price {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.collection__price input {
|
||||
width: 110px;
|
||||
height: 40px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid #d0d0d0;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.collection__filter-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-top: 22px;
|
||||
}
|
||||
|
||||
.collection__apply {
|
||||
height: 44px;
|
||||
padding: 0 22px;
|
||||
border: 0;
|
||||
border-radius: 60px;
|
||||
background: #9dd6c7;
|
||||
color: #000;
|
||||
font: inherit;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.collection__clear {
|
||||
color: #000;
|
||||
font-size: 15px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.collection__sort-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.collection__sort-option {
|
||||
padding: 6px 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #000;
|
||||
font: inherit;
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.collection__sort-option.is-current {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.collection__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 28px 20px;
|
||||
margin-top: 28px;
|
||||
}
|
||||
|
||||
.collection__promo {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
border-radius: 10px;
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
|
||||
.collection__promo img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.collection__empty {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.collection__pages {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 15px;
|
||||
margin-top: 48px;
|
||||
}
|
||||
|
||||
.collection__page,
|
||||
.collection__next {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 25px;
|
||||
color: #000;
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
line-height: 1;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.collection__page.is-current {
|
||||
background: #000;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.collection__next {
|
||||
background: #c9c9c9;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.collection__next svg {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@media (max-width: 1119px) {
|
||||
.collection__banner-copy {
|
||||
padding: 36px 40px;
|
||||
}
|
||||
|
||||
.collection__banner-blob {
|
||||
width: 120px;
|
||||
right: 16px;
|
||||
}
|
||||
|
||||
.collection__body,
|
||||
.collection__fallback-title {
|
||||
padding-right: 24px;
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.collection__grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.collection__banner {
|
||||
grid-template-columns: 1fr;
|
||||
min-height: 250px;
|
||||
}
|
||||
|
||||
.collection__banner-media {
|
||||
position: absolute;
|
||||
inset: 0 auto 0 0;
|
||||
width: 58%;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.collection__banner {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.collection__banner-image {
|
||||
min-height: 250px;
|
||||
}
|
||||
|
||||
.collection__banner-copy {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
min-height: 250px;
|
||||
justify-content: flex-end;
|
||||
gap: 15px;
|
||||
padding: 20px;
|
||||
background: linear-gradient(90deg, rgba(247, 197, 133, 0) 0%, #f7c585 46%);
|
||||
}
|
||||
|
||||
.collection__banner-title {
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.collection__banner-text {
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.collection__banner-blob {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.collection__body {
|
||||
padding: 18px 10px 48px;
|
||||
}
|
||||
|
||||
.collection__fallback-title {
|
||||
padding: 24px 16px 0;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.collection__bar {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.collection__tools {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.collection__tool {
|
||||
height: 40px;
|
||||
padding: 0 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.collection__count {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.collection__grid {
|
||||
gap: 20px 10px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.collection__panel {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
{% endstylesheet %}
|
||||
|
||||
{% javascript %}
|
||||
(() => {
|
||||
if (window.__seasonCollection) return;
|
||||
window.__seasonCollection = true;
|
||||
|
||||
const closePanels = (root) => {
|
||||
root.querySelectorAll('[data-filter-panel], [data-sort-panel]').forEach((panel) => {
|
||||
panel.classList.remove('is-open');
|
||||
});
|
||||
root.querySelectorAll('[data-filter-toggle], [data-sort-toggle]').forEach((button) => {
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
});
|
||||
};
|
||||
|
||||
const togglePanel = (root, name) => {
|
||||
const panel = root.querySelector(`[data-${name}-panel]`);
|
||||
const button = root.querySelector(`[data-${name}-toggle]`);
|
||||
if (!panel || !button) return;
|
||||
const willOpen = !panel.classList.contains('is-open');
|
||||
closePanels(root);
|
||||
if (willOpen) {
|
||||
panel.classList.add('is-open');
|
||||
button.setAttribute('aria-expanded', 'true');
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('click', (event) => {
|
||||
const root = event.target.closest('[data-collection]') || document.querySelector('[data-collection]');
|
||||
if (!root) return;
|
||||
|
||||
if (event.target.closest('[data-filter-toggle]')) {
|
||||
togglePanel(root, 'filter');
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.target.closest('[data-sort-toggle]')) {
|
||||
togglePanel(root, 'sort');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.target.closest('[data-filter-panel], [data-sort-panel]')) {
|
||||
closePanels(root);
|
||||
}
|
||||
});
|
||||
})();
|
||||
{% endjavascript %}
|
||||
|
||||
{% schema %}
|
||||
{
|
||||
"name": "t:general.collection",
|
||||
"settings": []
|
||||
"name": "t:collection_page.name",
|
||||
"tag": "section",
|
||||
"class": "collection-section",
|
||||
"settings": [
|
||||
{
|
||||
"type": "paragraph",
|
||||
"content": "t:collection_page.metafields"
|
||||
},
|
||||
{
|
||||
"type": "range",
|
||||
"id": "products_per_page",
|
||||
"label": "t:collection_page.products_per_page",
|
||||
"min": 6,
|
||||
"max": 24,
|
||||
"step": 3,
|
||||
"default": 9
|
||||
}
|
||||
]
|
||||
}
|
||||
{% endschema %}
|
||||
|
||||
Reference in New Issue
Block a user