<%= form_with url: transactions_path,
              id: "transactions-search",
              scope: :q,
              method: :get,
              data: { controller: "auto-submit-form" } do |form| %>
  <div class="flex gap-2 mb-4">
    <div class="grow">
      <div class="flex items-center px-3 py-2 gap-2 border border-gray-200 rounded-lg focus-within:ring-gray-100 focus-within:border-gray-900">
        <%= lucide_icon("search", class: "w-5 h-5 text-gray-500") %>
        <%= form.text_field :search,
                            placeholder: "Search transactions by name",
                            value: @q[:search],
                            class: "form-field__input placeholder:text-sm placeholder:text-gray-500",
                            "data-auto-submit-form-target": "auto" %>
      </div>
    </div>
    <div data-controller="menu" class="relative">
      <button id="transaction-filters-button" data-menu-target="button" type="button" class="btn btn--outline flex items-center gap-2">
        <%= lucide_icon("list-filter", class: "w-5 h-5 text-gray-500") %>
        <p class="text-sm font-medium text-gray-900">Filter</p>
      </button>

      <%= render "transactions/searches/menu", form: form %>
    </div>
  </div>
<% end %>
