{% sw_extends '@Storefront/storefront/layout/sidebar/category-navigation.html.twig' %}
{% block layout_navigation_categories %}
{% set navigationMaxDepth = context.salesChannel.navigationCategoryDepth %}
{% if not level %}
{% set level = 0 %}
{% endif %}
{% block layout_navigation_categories_list %}
<ul class="category-navigation text-sm grid grid-gap-y-1 level-{{ level }}">
{% for item in navigationTree %}
{% set currentCategory = item.category.id is same as(activeResult.id) %}
{% set inPath = item.category.id in activeResult.path %}
{% set directParent = (item.children is not empty) and not currentCategory %}
{# {{ dump(activeResult.level) }} #}
{% block layout_navigation_categories_list_entry %}
{% if (item.category.id in activeResult.id) or inPath %}
<li class="level-{{ level }} category-navigation-entry order-first grid grid-gap-y-1">
{% if item.category.type == 'folder' %}
{% block layout_navigation_categories_folder_children %}
<span class="category-navigation-link capitalize">{{ item.category.translated.name|lower }}</span>
{% endblock %}
{% else %}
{% block layout_navigation_categories_link_children %}
<a class="category-navigation-link capitalize hover:underline{% if currentCategory %} font-bold underline mt-2{% endif %}{% if inPath %} in-path flex items-center grid-gap-1{% endif %}{% if level === 1 %} font-bold{% endif %}{% if directParent %} -ml-1{% endif %}"
href="{{ category_url(item.category) }}"
{% if category_linknewtab(item.category) %}target="_blank"{% endif %}>
{% if directParent %}
<span class="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"
fill="currentColor" class="w-5 h-5">
<path fill-rule="evenodd"
d="M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z"
clip-rule="evenodd"/>
</svg>
</span>
{% endif %}
{% block layout_navigation_categories_link_children_name %}
{{ item.category.translated.name|lower }}
{% endblock %}
</a>
{% endblock %}
{% endif %}
{% block layout_navigation_categories_recoursion %}
{% if level < navigationMaxDepth %}
{% sw_include '@Storefront/storefront/layout/sidebar/category-navigation.html.twig' with {
navigationTree: item.children,
activeResult: activeResult,
level: level + 1,
} only %}
{% endif %}
{% endblock %}
</li>
{% else %}
<li class="level-{{ level }} not-active {% if (level === 0 and activeResult.level >= 2) or (level === 1 and activeResult.level >= 3) or (level === 2 and activeResult.level >= 4) %} top-level-categories sr-only {% endif %}">
{% if item.category.type == 'folder' %}
{% block layout_navigation_categories_text %}
<span class="category-navigation-link capitalize">{{ item.category.translated.name|lower }}</span>
{% endblock %}
{% else %}
{% block layout_navigation_categories_link %}
<a class="category-navigation-link capitalize hover:underline{% if currentCategory %} font-bold underline{% endif %}{% if parentCategory %} font-bold{% endif %}"
href="{{ category_url(item.category) }}"
{% if category_linknewtab(item.category) %}target="_blank"{% endif %}>
{% block layout_navigation_categories_link_name %}
{{ item.category.translated.name|lower }}
{% endblock %}
</a>
{% endblock %}
{% endif %}
</li>
{% endif %}
{% endblock %}
{% endfor %}
</ul>
{% endblock %}
{% endblock %}