{#
// inputs:
// - layout: string, one of [classic, topbar] (default: classic)
// - with_icons: boolean, (default: false)
#}

{% set layout = layout|default('classic') %}
{% set with_icons = with_icons|default(false) %}

<!-- .menu -->
<div class="menu menu--layout--{{ layout }} {% if with_icons %} menu--with-icons {% endif %}">
    <div class="menu__submenus-container"></div>
    <ul class="menu__list">
        {% for link in menu_links %}
            <li class="menu__item">
                <!-- This is a synthetic element that allows to adjust the vertical offset of the submenu using CSS. -->
                <div class="menu__item-submenu-offset"></div>

                <a class="menu__item-link" href="{{ link.url }}">
                    {% if with_icons and link.icon %}
                        <div class="menu__item-icon"><img {% if link.icon_srcset %} srcset="{{ link.icon_srcset }}" {% endif %} src="{{ link.icon }}" alt=""></div>
                    {% endif %}
                    {{ link.title }}
                    {% if link.submenu %}
                        <svg class="menu__item-arrow" width="6px" height="9px">
                            <use xlink:href="images/sprite.svg#arrow-rounded-right-6x9"></use>
                        </svg>
                    {% endif %}
                </a>
                {% if link.submenu %}
                    <div class="menu__submenu">
                        {% include '/header/menu.twig' with {
                            menu_links: link.submenu
                        } %}
                    </div>
                {% endif %}
            </li>
        {% endfor %}
    </ul>
</div>
<!-- .menu / end -->
