|
| 1 | +<nav class="w-full py-3 px-6 bg-white border-b border-gray-200"> |
| 2 | + <div class="flex justify-between items-center"> |
| 3 | + <div class="flex items-center gap-4"> |
| 4 | + <%# Main navigation links %> |
| 5 | + <%= link_to t("nav.home"), root_path, class: "text-sm font-medium text-gray-500 hover:text-gray-900 transition-colors" %> |
| 6 | + <%= link_to t("nav.about"), about_path, class: "text-sm font-medium text-gray-500 hover:text-gray-900 transition-colors" %> |
| 7 | + <%= link_to t("nav.new_entry"), new_entry_path, class: "text-sm font-medium text-gray-500 hover:text-gray-900 transition-colors" %> |
| 8 | + </div> |
| 9 | + |
| 10 | + <div class="flex items-center gap-4"> |
| 11 | + <%# Language dropdown %> |
| 12 | + <div class="relative"> |
| 13 | + <details class="group"> |
| 14 | + <summary class="list-none inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-gray-600 bg-gray-100 rounded-md cursor-pointer hover:bg-gray-200"> |
| 15 | + <span><%= I18n.locale.to_s.upcase %></span> |
| 16 | + <svg class="w-4 h-4" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> |
| 17 | + <path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.23 8.27a.75.75 0 01.02-1.06z" clip-rule="evenodd"/> |
| 18 | + </svg> |
| 19 | + </summary> |
| 20 | + <div class="absolute right-0 mt-2 w-44 bg-white border border-gray-200 rounded-md shadow-lg py-1 z-20"> |
| 21 | + <%= link_to "English (EN)", locale_url(:en), class: "block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" %> |
| 22 | + <%= link_to "Español (ES)", locale_url(:es), class: "block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" %> |
| 23 | + <%= link_to "Français (FR)", locale_url(:fr), class: "block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" %> |
| 24 | + <%= link_to "Português (PT)", locale_url(:pt), class: "block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" %> |
| 25 | + <%= link_to "Bahasa Indonesia (ID)", locale_url(:id), class: "block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" %> |
| 26 | + <%= link_to "中文 (ZH)", locale_url(:zh), class: "block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" %> |
| 27 | + <%= link_to "日本語 (JA)", locale_url(:ja), class: "block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" %> |
| 28 | + </div> |
| 29 | + </details> |
| 30 | + </div> |
| 31 | + |
| 32 | + <% if user_signed_in? %> |
| 33 | + <%# Authenticated user menu %> |
| 34 | + <%= link_to t("nav.dashboard"), entries_path, class: "text-sm font-medium text-gray-500 hover:text-gray-900 transition-colors" %> |
| 35 | + |
| 36 | + <div class="relative inline-block text-left"> |
| 37 | + <div class="group"> |
| 38 | + <button type="button" class="inline-flex items-center justify-center px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-md hover:bg-indigo-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-indigo-500 transition-colors"> |
| 39 | + <span><%= t("nav.menu") %></span> |
| 40 | + <svg class="w-5 h-5 ml-2 -mr-1" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> |
| 41 | + <path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.23 8.27a.75.75 0 01.02-1.06z" clip-rule="evenodd"/> |
| 42 | + </svg> |
| 43 | + </button> |
| 44 | + |
| 45 | + <div class="absolute right-0 w-56 mt-2 origin-top-right bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 ease-in-out z-10 focus:outline-none"> |
| 46 | + <div class="px-4 py-3"> |
| 47 | + <p class="text-sm text-gray-500"><%= t("nav.signed_in_as") %></p> |
| 48 | + <p class="text-sm font-medium text-gray-900 truncate"><%= @current_user.email %></p> |
| 49 | + </div> |
| 50 | + <div class="py-1 border-t border-gray-100"> |
| 51 | + <%= link_to t("nav.profile"), edit_user_registration_path, class: "block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" %> |
| 52 | + <%= link_to t("nav.sign_out"), destroy_user_session_path, data: { turbo_method: :delete }, class: "block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" %> |
| 53 | + </div> |
| 54 | + </div> |
| 55 | + </div> |
| 56 | + </div> |
| 57 | + <% else %> |
| 58 | + <%# Guest menu %> |
| 59 | + <%= link_to t("nav.sign_in"), new_user_session_path, class: "text-sm font-medium text-gray-500 hover:text-gray-900 transition-colors" %> |
| 60 | + <%= link_to t("nav.sign_up"), new_user_registration_path, class: "rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 transition-colors" %> |
| 61 | + <% end %> |
| 62 | + </div> |
| 63 | + </div> |
| 64 | +</nav> |
0 commit comments