{% import "macros/formatting.html.jinja" as fmt with context -%}

<nav class="navbar navbar-default navbar-static-top">
  <div class="container">
    <div class="navbar-header">
      <button
        type="button"
        class="navbar-toggle collapsed"
        data-toggle="collapse"
        data-target="#navbar-collapse"
        aria-expanded="false"
      >
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="{{ relative_site_url }}">{{ _("hexdoc."~props.modid~".title") }}</a>
    </div>

    <div class="collapse navbar-collapse" id="navbar-collapse">
      {% set navbar = navbar|default({}) %}
      {% if navbar.left|default(false) %}
        <ul class="nav navbar-nav navbar-left">
          {% for item in navbar.left %}
            {{ fmt.navbar_link(item) }}
          {% endfor %}
        </ul>
      {% endif %}
      <ul class="nav navbar-nav navbar-right">
        {% for item in navbar.center|default([]) %}
          {{ fmt.navbar_link(item) }}
        {% endfor %}
        <li class="dropdown">
          <a
            href=""
            class="dropdown-toggle"
            data-toggle="dropdown"
            role="button"
            aria-haspopup="true"
            aria-expanded="false"
          >{{ version }} <span class="caret"></span></a>
          <ul class="dropdown-menu" id="version-dropdown"></ul>
        </li>
        <li class="dropdown">
          <a
            href=""
            class="dropdown-toggle"
            data-toggle="dropdown"
            role="button"
            aria-haspopup="true"
            aria-expanded="false"
          >{{ lang_name }} <span class="caret"></span></a>
          <ul class="dropdown-menu dropdown-menu-left" id="lang-dropdown"></ul>
        </li>
        {% for item in navbar.right|default([]) %}
          {{ fmt.navbar_link(item) }}
        {% endfor %}
      </ul>
    </div>
  </div>
</nav>
