1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-09 07:25:19 +02:00

Change sort direction to be a LinkComponent outside of the form for better sort behavior

This commit is contained in:
hatz 2025-05-08 09:17:17 -05:00
parent dfef2897e0
commit edd048f791
No known key found for this signature in database

View file

@ -46,17 +46,14 @@
{}, {},
class: "min-w-[120px] bg-container rounded border-primary cursor-pointer text-primary text-sm w-auto", class: "min-w-[120px] bg-container rounded border-primary cursor-pointer text-primary text-sm w-auto",
data: { auto_submit_form_target: "auto", autosubmit_trigger_event: "change" } %> data: { auto_submit_form_target: "auto", autosubmit_trigger_event: "change" } %>
<%= form.hidden_field :direction, value: (@direction == "asc" ? "desc" : "asc") %> <%= form.hidden_field :direction, value: @direction %>
<%= render ButtonComponent.new( <% end %>
variant: :icon, <%= render LinkComponent.new(
href: rules_path(direction: @direction == "asc" ? "desc" : "asc", sort_by: @sort_by),
variant: "icon",
icon: "arrow-up-down", icon: "arrow-up-down",
size: :sm,
type: "submit",
title: "Toggle sort direction" title: "Toggle sort direction"
) do %> ) %>
<span class="sr-only">Toggle sort direction</span>
<% end %>
<% end %>
</div> </div>
</div> </div>
<div class="p-1"> <div class="p-1">