| 1 | <%# locals: branches, current_branch, branch_url (proc: branch name -> url) %> |
| 2 | <details class="branch-switcher relative"> |
| 3 | <summary class="btn-secondary py-1 px-3 text-xs font-mono flex items-center gap-1.5 cursor-pointer list-none"> |
| 4 | <svg class="w-3.5 h-3.5 shrink-0" viewBox="0 0 16 16" fill="currentColor"> |
| 5 | <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"/> |
| 6 | </svg> |
| 7 | <%= current_branch %> |
| 8 | <svg class="w-3 h-3 text-gray-500 shrink-0" viewBox="0 0 16 16" fill="currentColor"> |
| 9 | <path d="M4.427 6.427 8 9.999l3.573-3.572a.25.25 0 0 1 .354.354l-3.75 3.75a.25.25 0 0 1-.354 0l-3.75-3.75a.25.25 0 1 1 .354-.354Z"/> |
| 10 | </svg> |
| 11 | </summary> |
| 12 | <div class="absolute left-0 mt-2 w-64 z-10 card p-1 max-h-80 overflow-y-auto text-left"> |
| 13 | <% branches.each do |b| %> |
| 14 | <%= link_to branch_url.call(b), |
| 15 | class: "flex items-center gap-2 px-3 py-1.5 rounded text-sm hover:bg-surface-600 #{b == current_branch ? 'text-brand-500 font-medium' : 'text-gray-200'}" do %> |
| 16 | <svg class="w-3.5 h-3.5 shrink-0 <%= b == current_branch ? '' : 'invisible' %>" viewBox="0 0 16 16" fill="currentColor"> |
| 17 | <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.75.75 0 0 1 1.06-1.06L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"/> |
| 18 | </svg> |
| 19 | <span class="font-mono truncate"><%= b %></span> |
| 20 | <% end %> |
| 21 | <% end %> |
| 22 | </div> |
| 23 | </details> |