-
Notifications
You must be signed in to change notification settings - Fork 40
/
collection-list.liquid
85 lines (79 loc) · 2.31 KB
/
collection-list.liquid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{%- comment -%}
This is a required section for the Shopify Theme Store.
It is available when you add "Collection list" section in the Theme Editor.
Theme Store required settings
- Heading: title of the collection list section
- Collection
{%- endcomment -%}
<section class="collection-list">
{% if section.settings.title != blank %}
<h2 class="collection-list__title">{{ section.settings.title | escape }}</h2>
{% endif %}
{% for block in section.blocks %}
{%- assign collection = collections[block.settings.collection] -%}
<a href="{{ collection.url | default: "#" }}" class="collection-list-item" {{ block.shopify_attributes }}>
{% if collection.image != blank or collection.products.first != blank %}
{%- assign image_object = collection.image | default: collection.products.first.featured_image -%}
<div class="collection-list__image">
{% include 'responsive-image' with
image: image_object,
max_width: 480,
max_height: 480
%}
</div>
{% elsif collection == empty %}
{% capture current %}{% cycle 1, 2, 3, 4, 5, 6 %}{% endcapture %}
{{ 'collection-' | append: current | placeholder_svg_tag: 'placeholder-svg placeholder-svg--small' }}
{% endif %}
{%- assign default_label = 'homepage.onboarding.collection_title' | t -%}
<p>{{ collection.title | default: default_label }}</p>
</a>
{% endfor %}
{% if section.blocks.size == 0 %}
{% include 'no-blocks' %}
{% endif %}
</section>
{% schema %}
{
"name": "Collection list",
"max_blocks": 12,
"settings": [
{
"type": "text",
"id": "title",
"label": "Heading",
"default": "Collection list"
}
],
"blocks": [
{
"type": "collection",
"name": "Collection",
"settings": [
{
"label": "Collection",
"id": "collection",
"type": "collection"
}
]
}
],
"presets": [
{
"name": "Collection list",
"category": "Collection",
"blocks": [
{
"type": "collection"
},
{
"type": "collection"
},
{
"type": "collection"
}
]
}
]
}
{% endschema %}