{{ $home      := site.BaseURL }}
{{ $logo      := site.Params.logos.navbar }}
{{ $social    := site.Params.social }}
{{ $github    := $social.github }}
{{ $twitter   := printf "https://twitter.com/%s" $social.twitter }}
{{ $medium    := $social.medium }}
{{ $slack     := $social.slack }}
{{ $docsHome  := .CurrentSection }}
{{ $allDocs   := where site.RegularPages "Section" "docs" }}
{{ $docs       := where $allDocs ".Params.kind" "eq" "documentation" }}
{{ $kubernetes := where $allDocs ".Params.kind" "eq" "kubernetes" }}
{{ $tutorials  := where $allDocs ".Params.kind" "eq" "tutorial" }}
{{ $operations := where $allDocs ".Params.kind" "eq" "operations" }}
{{ $misc := where $allDocs ".Params.kind" "eq" "misc" }}
{{ $version   := index (split .File.Path "/") 1 }}
{{ $pageUrl   := .URL }}
<nav class="navbar is-primary">
  <div class="navbar-brand is-hidden-tablet">
    <a class="navbar-item" href="{{ $home }}">
      <img src="{{ $logo }}">
    </a>

    <a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="mobile-menu">
      <span aria-hidden="true"></span>
      <span aria-hidden="true"></span>
      <span aria-hidden="true"></span>
    </a>
  </div>

  <div class="navbar-menu is-hidden-tablet" id="mobile-menu">
    <div class="navbar-start">
      <span class="navbar-item is-size-5 has-text-weight-light is-uppercase">
        Core Docs
      </span>

      <a class="navbar-item" href="{{ $docsHome.URL }}">
        {{ $docsHome.Name }}
      </a>

      {{ range $docs }}
      {{ partial "docs/navbar-link.html" (dict "ctx" . "pageUrl" $pageUrl "version" $version) }}
      {{ end }}

      {{ partial "docs/navbar-section.html" ( dict "ctx" . "sectionTitle" "Kubernetes" "section" $kubernetes "pageUrl" $pageUrl "version" $version ) }}

      {{ partial "docs/navbar-section.html" ( dict "ctx" . "sectionTitle" "Other Use Cases" "section" $tutorials "pageUrl" $pageUrl "version" $version ) }}

      {{ partial "docs/navbar-section.html" ( dict "ctx" . "sectionTitle" "Operations" "section" $operations "pageUrl" $pageUrl "version" $version ) }}

      {{ partial "docs/navbar-section.html" ( dict "ctx" . "sectionTitle" "Miscellaneous" "section" $misc "pageUrl" $pageUrl "version" $version ) }}

    </div>

    <div class="navbar-end">
      <!--
      <div class="navbar-item">
        <div class="field">
          <p class="control is-expanded has-icons-right">
            <input class="input" type="search" placeholder="Search...">
            <span class="icon is-small is-right">
              <icon />
            </span>
          </p>
        </div>
      </div>
      -->

      <div class="navbar-item">
        <div class="buttons">
          <a class="button is-primary" href="{{ $github }}" target="_blank">
            <span class="icon has-text-white-bis">
              <i class="fab fa-github"></i>
            </span>
          </a>

          <a class="button is-primary" href="{{ $twitter }}" target="_blank">
            <span class="icon has-text-white-bis">
              <i class="fab fa-twitter"></i>
            </span>
          </a>

          <a class="button is-primary" href="{{ $medium }}" target="_blank">
            <span class="icon has-text-white-bis">
              <i class="fab fa-medium"></i>
            </span>
          </a>

          <a class="button is-primary" href="{{ $slack }}" target="_blank">
            <span class="icon has-text-white-bis">
              <i class="fab fa-slack"></i>
            </span>
          </a>
        </div>
      </div>
    </div>
  </div>

  <div class="navbar-menu">
    <div class="navbar-end">
      <div class="navbar-item">
        <p class="control has-icons-right">
          <input class="input" type="search" id="search-bar" placeholder="Search...">
          <span class="icon is-small is-right">
            <icon />
          </span>
        </p>
      </div>

      <a class="navbar-item" href="{{ $github }}" target="_blank">
        <span class="icon has-text-white-bis">
          <i class="fab fa-github"></i>
        </span>
      </a>

      <a class="navbar-item" href="{{ $twitter }}" target="_blank">
        <span class="icon has-text-white-bis">
          <i class="fab fa-twitter"></i>
        </span>
      </a>

      <a class="navbar-item" href="{{ $medium }}" target="_blank">
        <span class="icon has-text-white-bis">
          <i class="fab fa-medium"></i>
        </span>
      </a>

      <a class="navbar-item" href="{{ $slack }}" target="_blank">
        <span class="icon has-text-white-bis">
          <i class="fab fa-slack"></i>
        </span>
      </a>
    </div>
  </div>
</nav>