<%= content_for :page_title, t(".tags") %>
<%= content_for :page_actions do %>
  <%= render DS::Menu.new do |menu| %>
    <% menu.with_item(
          variant: "button",
          text: "Delete all",
          href: destroy_all_tags_path,
          method: :delete,
          icon: "trash-2",
          confirm: CustomConfirm.for_resource_deletion("all tags", high_severity: true)) %>
  <% end %>

  <%= render DS::Link.new(
    text: t(".new"),
    variant: "primary",
    href: new_tag_path,
    icon: "plus",
    frame: :modal
  ) %>
<% end %>

<div class="bg-container rounded-xl shadow-border-xs p-4">
  <% if @tags.any? %>
    <div class="rounded-xl bg-container-inset space-y-1 p-1">
      <div class="flex items-center gap-1.5 px-4 py-2 text-xs font-medium text-secondary uppercase">
        <p><%= t(".tags") %></p>
        <span class="text-subdued">&middot;</span>
        <p><%= @tags.count %></p>
      </div>

      <div class="bg-container rounded-lg shadow-border-xs">
        <div class="overflow-hidden rounded-lg">
          <%= render partial: @tags, spacer_template: "shared/ruler" %>
        </div>
      </div>
    </div>
  <% else %>
    <div class="flex justify-center items-center py-20">
      <div class="text-center flex flex-col items-center max-w-[300px]">
        <p class="text-primary mb-1 font-medium text-sm"><%= t(".empty") %></p>

        <%= render DS::Link.new(
          text: t(".new"),
          icon: "plus",
          href: new_tag_path,
          frame: :modal
        ) %>
      </div>
    </div>
  <% end %>
</div>
