<nav
  class="navbar navbar-expand-lg bg-body-tertiary bg-dark"
  data-bs-theme="dark"
>
  <div class="container-fluid">
    <a class="navbar-brand" href="/">BlogBy</a>
    <button
      class="navbar-toggler"
      type="button"
      data-bs-toggle="collapse"
      data-bs-target="#navbarNavDropdown"
      aria-controls="navbarNavDropdown"
      aria-expanded="false"
      aria-label="Toggle navigation"
    >
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNavDropdown">
      <ul class="navbar-nav">
        <li class="nav-item">
          <a class="nav-link active" aria-current="page" href="/">Home</a>
        </li>
        <% if (locals.user) { %>
        <li class="nav-item">
          <a class="nav-link" href="/blog/add-new">Add Blog</a>
        </li>
        <li class="nav-item dropdown">
          <a
            class="nav-link dropdown-toggle"
            href="#"
            role="button"
            data-bs-toggle="dropdown"
            aria-expanded="false"
          >
            Emad Abd Al Fatah
          </a>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item" href="/user/logout">Logout</a></li>
          </ul>
        </li>
        <% } else {%>
        <li class="nav-item">
          <a class="nav-link" href="/user/signup">Create Account</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/user/signin">Signin</a>
        </li>
        <% } %>
      </ul>
    </div>
  </div>
</nav>

<% if (locals.error) { %>
<div class="container mt-4">
  <div class="alert alert-danger" role="alert"><%= locals.error %></div>
</div>
<% } %>
