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

{# VARIABLES #}
{% set devider = separator|default("|") %}
{% if separator == 'slash' %}{% set devider = "/" %}{% endif %}
{% if separator == 'pipe' %}{% set devider = "|" %}{% endif %}
{% if separator == 'arrow' %}{% set devider = "&gt;" %}{% endif %}
{% if separator == 'raquo' %}{% set devider = "&raquo;" %}{% endif %}
{% if separator == 'icon' %}{% set devider = "<i class='fal fa-angle-right'></i>" %}{% endif %}

{# TEMPLATE #}
{% if breadcrumb %}
  <nav aria-label="breadcrumb" class="{{ utility_classes|join(' ') }}">
    <ol class="breadcrumb mb-1">
      {%- for item in breadcrumb %}
        <li class="breadcrumb-item {{ not item.url ? 'active' }}">
          {% if item.url %}
            <a class="bci-text" href="{{ item.url }}">{{ item.text }}</a>{% if not loop.last %}{{ devider|raw }}{% endif %}
          {% else %}
            <span class="bci-text">{{ item.text }}</span>{% if not loop.last %}{{ devider|raw }}{% endif %}
          {% endif %}
        </li>
      {%- endfor %}
    </ol>
  </nav>
{% endif %}
