{% macro item(taxon) %}
    {% import _self as macros %}

    {% if taxon.enabledChildren|length > 0 %}
        <div class="ui dropdown item" {{ sylius_test_html_attribute('menu-item', taxon.name) }}>
            <span class="text">{{ taxon.name }}</span>
            <i class="dropdown icon"></i>
            <div class="menu">
                {% for childTaxon in taxon.enabledChildren %}
                    {{ macros.item(childTaxon) }}
                {% endfor %}
            </div>
        </div>
    {% else %}
        <a href="{{ path('sylius_shop_product_index', {'slug': taxon.slug, '_locale': taxon.translation.locale}) }}" class="item" {{ sylius_test_html_attribute('menu-item', taxon.name) }}>{{ taxon.name }}</a>
    {% endif %}
{% endmacro %}

{% import _self as macros %}

{% if taxons|length > 0 %}
<div class="ui large stackable menu" {{ sylius_test_html_attribute('menu') }}>
    {% for taxon in taxons %}
        {{ macros.item(taxon) }}
    {% endfor %}
</div>
{% endif %}
