{# LIBRARIES #}
{{ attach_library('ui_patterns/libraries.bs_dropdown') }}

{#
/**
 * @file
 * Template for a Dropdown menu component.
 */
#}
<ul class="dropdown-menu">
  {% for item in items %}

    {% set nav_link_classes = [
      'dropdown-item',
      item.in_active_trail ? 'active'
    ] %}

    {% set item_attributes = create_attribute() %}
    {% if item.url.options.attributes is defined %}
      {% set item_attributes = item.url.options.attributes %}
    {% endif %}

    <li>
      {% include "@atoms/tm-links/standard/standard.twig" with {
        "text": item.title,
        "url": item.url,
        "class": nav_link_classes,
        "attributes": item_attributes
      } only %}
    </li>

  {% endfor %}
</ul>
