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

Add grid settings to collections list #1469

Merged
merged 7 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
15 changes: 15 additions & 0 deletions locales/en.default.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,21 @@
"label": "Square"
},
"info": "Add images by editing your collections. [Learn more](https://help.shopify.com/en/manual/products/collections)"
},
"columns_desktop": {
"label": "Number of columns on desktop"
},
"header_mobile": {
"content": "Mobile Layout"
},
"columns_mobile": {
"label": "Number of columns on mobile",
"options__1": {
"label": "1 column"
},
"options__2": {
"label": "2 columns"
}
}
}
},
Expand Down
32 changes: 30 additions & 2 deletions sections/main-list-collections.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
assign collections = collections | reverse
endif
-%}
<ul class="collection-list grid grid--1-col grid--3-col-tablet" role="list">
<ul class="collection-list grid grid--{{ section.settings.columns_desktop }}-col-desktop grid--{{ section.settings.columns_mobile }}-col-tablet-down" role="list">
{%- for collection in collections -%}
<li class="collection-list__item grid__item">
{% render 'card-collection', card_collection: collection, media_aspect_ratio: section.settings.image_ratio, columns: 3 %}
</li>
{%- endfor -%}
</ul>
</div>

{% schema %}
{
"name": "t:sections.main-list-collections.name",
Expand Down Expand Up @@ -87,6 +86,35 @@
"default": "adapt",
"label": "t:sections.main-list-collections.settings.image_ratio.label",
"info": "t:sections.main-list-collections.settings.image_ratio.info"
},
{
"type": "range",
"id": "columns_desktop",
"min": 1,
"max": 5,
"step": 1,
"default": 3,
"label": "t:sections.main-list-collections.settings.columns_desktop.label"
},
{
"type": "header",
"content": "t:sections.main-list-collections.settings.header_mobile.content"
},
{
"type": "select",
"id": "columns_mobile",
"options": [
{
"value": "1",
"label": "t:sections.main-list-collections.settings.columns_mobile.options__1.label"
},
{
"value": "2",
"label": "t:sections.main-list-collections.settings.columns_mobile.options__2.label"
}
],
"default": "2",
"label": "t:sections.main-list-collections.settings.columns_mobile.label"
}
]
}
Expand Down