<!-- Navigation -->
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark fixed-top">
  <div class="container">
    <%= link_to 'THE MODERN LIBRARY', root_path, class: 'navbar-brand' %>
    <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarResponsive">
      <ul class="navbar-nav ml-auto">
        <li class="nav-item">
          <%= link_to 'All Books', books_path, class: 'nav-link' %>
        </li>
        <% if current_user %>
        <% if current_user.admin? %>
        <li class="nav-item">
          <%= link_to 'Admin panel', admin_books_path, class: 'nav-link' %>
        </li>
        <% else %>
        <li class="nav-item">
          <%= link_to 'Dashboard', dashboard_index_path, class: 'nav-link' %>
        </li>
        <% end %>

        <li class="nav-item">
          <%= link_to 'Signout', destroy_user_session_path, method: :delete, class: 'nav-link' %>
        </li>
        <% else %>
        <li class="nav-item">
          <%= link_to 'Login', new_user_session_path, class: 'nav-link' %>
        </li>
        <li class="nav-item">
          <%= link_to 'Join us now!', new_user_registration_path, class: 'nav-link' %>
        </li>
        <% end %>
      </ul>
    </div>
  </div>
</nav>