{% 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-md-4 col-sm-6 {% endif %} col-12 mb-md-5 mb-3 px-md-4 px-3" {{ 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}) }}"><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}) }}">{{ taxon.name }}</a></h3>
<div class="flex-grow-l text-grey fontsize-normal">
<p>{{ taxon.description|raw }}</p>
</div>
<div class="">
<ul class="row mx-n2 list-unstyled">
{% for childTaxon in taxon.children %}
<li class="{% if isChild <= 2 %}col-6 {% else %}col-12{% endif %} px-2 "><a href="{{ path('sylius_shop_product_index', {'slug': childTaxon.slug, '_locale': childTaxon.translation.locale}) }}">> <span>{{ childTaxon.name }}</span></a></li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% else %}
<div class="{% if isChild <= 2 %}col-sm-6 {% else %} col-md-4 col-sm-6 {% endif %} col-12 mb-md-5 mb-3 px-md-4 px-3">
<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}) }}"><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}) }}">{{ taxon.name }}</a></h3>
<div class="flex-grow-l text-grey fontsize-normal">
<p>{{ taxon.description|raw }}</p>
</div>
<div class="">
<ul class="row mx-n2 list-unstyled">
{% for childTaxon in taxon.children %}
<li class="{% if isChild <= 2 %}col-6 {% else %}col-12{% endif %} px-2 "><a href="{{ path('sylius_shop_product_index', {'slug': childTaxon.slug, '_locale': childTaxon.translation.locale}) }}">> <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-3 py-md-5 pt-4 pb-2 mt-2 mt-md-4">
<div class="max-container-2 px-0">
<h2 class="title-medium color-blue-s text-left">{{'app.homepage.our_categories'|trans}}</h2>
<div class="row mx-xl-n4 mx-n3 pt-2 pt-md-3">
{% for taxon in taxons %}
{{ macros.item(taxon, loop.index) }}
{% endfor %}
</div>
</div>
</div>
{% endif %}