app/views/shared/_nav.html.erb
<nav class="w-full bg-gray-800" data-controller="nav">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex items-center justify-between h-16">
<div class="flex items-center">
<div class="flex-shrink-0">
<img class="h-8 w-8" src="https://tailwindui.com/img/logos/workflow-mark-indigo-500.svg" alt="Workflow">
</div>
<div class="hidden md:block">
<div class="ml-10 flex items-baseline space-x-4">
<!-- Current: "bg-gray-900 text-white", Default: "text-gray-300 hover:bg-gray-700 hover:text-white" -->
<%= link_to 'Dashboard', authenticated_root_path, class: %w[bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium] %>
</div>
</div>
</div>
<div class="hidden md:block">
<div class="ml-4 flex items-center md:ml-6">
<!-- User menu dropdown -->
<div class="ml-3 relative">
<div>
<button class="bg-gray-800 p-1 rounded-full text-gray-400 hover:text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-800 focus:ring-white" data-action="click->nav#toggleUserMenuVisibility">
<span class="sr-only">Open user menu</span>
<!-- Heroicon name: outline/user -->
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
</svg>
</button>
</div>
<div class="origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg py-1 bg-white ring-1 ring-black ring-opacity-5 transform opacity-0 scale-95 " role="menu" aria-orientation="vertical" aria-labelledby="user-menu" data-nav-target="userMenu">
<%= link_to 'Sign out', destroy_user_session_path, class: %w[block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100], method: :delete %>
</div>
</div>
</div>
</div>
<div class="-mr-2 flex md:hidden">
<!-- Mobile menu button -->
<button class="bg-gray-800 inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-800 focus:ring-white" data-action="click->nav#toggleMobileMenuVisibility">
<span class="sr-only">Open main menu</span>
<!-- Heroicon name: outline/menu -->
<svg class="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true" data-nav-target="mobileOpenMenuIcon">>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
</svg>
<!-- Heroicon name: outline/x -->
<svg class="hidden h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true" data-nav-target="mobileCloseMenuIcon">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
</div>
<!-- Mobile menu -->
<div class="hidden md:hidden" data-nav-target="mobileMenu">
<div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
<!-- Current: "bg-gray-900 text-white", Default: "text-gray-300 hover:bg-gray-700 hover:text-white" -->
<%= link_to 'Dashboard', authenticated_root_path, class: %w[bg-gray-900 text-white block px-3 py-2 rounded-md text-base font-medium] %>
</div>
<div class="pt-4 pb-3 border-t border-gray-700">
<div class="flex items-center px-5">
<div class="flex-shrink-0">
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="white">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
</svg>
</div>
<div class="ml-3">
<div class="text-base font-medium leading-none text-white"><%= current_user.email %></div>
</div>
</div>
<div class="mt-3 px-2 space-y-1">
<%= link_to 'Sign out', destroy_user_session_path, class: %w[block px-3 py-2 rounded-md text-base font-medium text-gray-400 hover:text-white hover:bg-gray-700], method: :delete %>
</div>
</div>
</div>
</nav>