{% import "@SyliusShop/Common/Macro/icons.html.twig" as icons %}
{% macro item(taxon, isChild) %}
{% import _self as macros %}
{% if taxon.children|length > 0 %}
<div class="{% if isChild <= 2 %}col-sm-6 {% else %}col-sm-4 {% endif %} col-12 mb-md-5 mb-3 px-md-4 px-sm-3 px-2 wow fadeIn" {{ sylius_test_html_attribute('menu-item') }}>
<div class="h-100 category-item-index flex-column d-flex">
<div class="category-item-img mx-sm-0 mx-n3">
{% if taxon.images.first %}
{% set path = taxon.images.first.path|imagine_filter(filter|default('app_shop_taxon_show_index')) %}
{% else %}
{% set path = asset('images/imgcateg_i1.jpg') %}
{% endif %}
<a href="{{ path('sylius_shop_product_index', {'slug': taxon.slug, '_locale': taxon.translation.locale, 'id': taxon.oldId}) }}" title="{{ taxon.name }}"><img src="{{ path }}" alt="{{ taxon.name }}" class="w-100" /></a>
</div>
<h3 class="category-item-lib"><a href="{{ path('sylius_shop_product_index', {'slug': taxon.slug, '_locale': taxon.translation.locale, 'id': taxon.oldId}) }}" title="{{ taxon.name }}">{{ taxon.name }}</a></h3>
<div class="flex-grow-l_ text-grey category-item-desc">
<p class="mb-1">{{ taxon.description|raw }}</p>
</div>
<div class="">
<ul class="row mx-n2 list-unstyled mb-0">
{% for childTaxon in taxon.children %}
<li class="{% if isChild <= 2 %}col-md-6 col-sm-12 col-6 {% else %}col-sm-12 col-6{% endif %} px-2 "><a href="{{ path('sylius_shop_product_index', {'slug': childTaxon.slug, '_locale': childTaxon.translation.locale, 'id': childTaxon.oldId}) }}" title="{{ childTaxon.name }}">> <span>{{ childTaxon.name }}</span></a></li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% else %}
<div class="{% if isChild <= 2 %}col-sm-6 {% else %}col-sm-4 {% endif %} col-12 mb-md-5 mb-3 px-md-4 px-sm-3 px-2 wow fadeIn">
<div class="h-100 category-item-index flex-column d-flex">
<div class="category-item-img mx-sm-0 mx-n3">
{% if taxon.images.first %}
{% set path = taxon.images.first.path|imagine_filter(filter|default('app_shop_taxon_show_index')) %}
{% else %}
{% set path = asset('images/imgcateg_i1.jpg') %}
{% endif %}
<a href="{{ path('sylius_shop_product_index', {'slug': taxon.slug, '_locale': taxon.translation.locale, 'id': taxon.oldId}) }}" title="{{ taxon.name }}"><img src="{{ path }}" alt="{{ taxon.name }}" class="w-100" /></a>
</div>
<h3 class="category-item-lib"><a href="{{ path('sylius_shop_product_index', {'slug': taxon.slug, '_locale': taxon.translation.locale, 'id': taxon.oldId}) }}" title="{{ taxon.name }}">{{ taxon.name }}</a></h3>
<div class="flex-grow-l text-grey">
<p class="mb-1">{{ taxon.description|raw }}</p>
</div>
<div class="">
<ul class="row mx-n2 list-unstyled mb-0">
{% for childTaxon in taxon.children %}
<li class="{% if isChild <= 2 %}col-md-6 col-sm-12 col-6 {% else %}col-sm-12 col-6{% endif %} px-2 "><a href="{{ path('sylius_shop_product_index', {'slug': childTaxon.slug, '_locale': childTaxon.translation.locale, 'id': childTaxon.oldId}) }}" title="{{ childTaxon.name }}">> <span>{{ childTaxon.name }}</span></a></li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endif %}
{% endmacro %}
{% import _self as macros %}
{% if taxons|length > 0 %}
<section class="bloc-category-index px-md-3 px-2 pb-md-0 pt-4 pb-2 mt-2 ">
<div class="max-container-5 px-0">
<h2 class="title-medium color-black text-center">{{'app.homepage.our_categories'|trans}}</h2>
<div class="row mx-xl-n4 mx-sm-n3 mx-n2 pt-2 pt-md-3">
{% for taxon in taxons %}
{{ macros.item(taxon, loop.index) }}
{% endfor %}
</div>
</div>
</section>
{% endif %}