Skip to content

Instantly share code, notes, and snippets.

@Dimls
Created March 13, 2018 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dimls/4785f53bf13c67ffdccd75cbef75f3bf to your computer and use it in GitHub Desktop.
Save Dimls/4785f53bf13c67ffdccd75cbef75f3bf to your computer and use it in GitHub Desktop.
<div class = "wrapper">
{% if section.settings.title != blank %}
<div class="text-center list-collectons-title">
<h2>{{ section.settings.title | escape }}</h2>
</div>
{% endif %}
{% case section.settings.grid %}
{% when 2 %}
{%- assign grid_item_width = 'large--one-half medium-down--one-whole' -%}
{% when 3 %}
{%- assign grid_item_width = 'large--one-third medium-down--one-whole' -%}
{% when 4 %}
{%- assign grid_item_width = 'large--one-quarter medium-down--one-whole' -%}
{% when 5 %}
{%- assign grid_item_width = 'large--one-fifth medium-down--one-whole' -%}
{% endcase %}
<div class="collection-grid">
<div class="grid grid--uniform">
{% for block in section.blocks limit: section.blocks.size %}
<div class="grid__item {{ grid_item_width }}" {{ block.shopify_attributes }}>
{%- assign collection = collections[block.settings.collection] -%}
{% include 'collection-grid-item' %}
</div>
{% endfor %}
</div>
</div>
</div>
{% schema %}
{
"name": "Collection list",
"class": "collection-list",
"max_blocks": 12,
"settings": [
{
"type": "text",
"id": "title",
"label": "Title",
"default": "Collection list"
},
{
"type": "range",
"id": "grid",
"label": "Collections per row",
"min": 2,
"max": 5,
"step": 1,
"default": 3
},
{
"type": "select",
"id": "title_position",
"label": "Collection title position",
"default": "below",
"options": [
{
"value": "below",
"label": "Below"
},
{
"value": "above",
"label": "Above"
}
]
}
],
"blocks": [
{
"type": "featured_collection",
"name": "Collection",
"settings": [
{
"label": "Collection",
"id": "collection",
"type": "collection"
}
]
}
],
"presets": [
{
"name": "Collection list",
"category": "Collection",
"blocks": [
{
"type": "featured_collection"
},
{
"type": "featured_collection"
},
{
"type": "featured_collection"
}
]
}
]
}
{% endschema %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment