chore: simplify table component

1. We can't add `Enum.with_index/1` in a `for` comprehension
2. We don't have access to the list index
This commit is contained in:
Joao P Dubas 2023-11-20 14:32:48 +00:00
parent f70f363f0a
commit d4f83e1a4b

View file

@ -588,7 +588,7 @@ defmodule LiveBeatsWeb.CoreComponents do
data-drop={@sortable_drop}
>
<tr
:for={{row, i} <- Enum.with_index(@rows)}
:for={row <- @rows}
id={@row_id && @row_id.(row)}
phx-remove={@row_remove && @row_remove.(row)}
class="hover:bg-gray-50"
@ -598,7 +598,7 @@ defmodule LiveBeatsWeb.CoreComponents do
phx-click={@row_click && @row_click.(row)}
class={
col[:class!] ||
"px-6 py-3 whitespace-nowrap text-sm font-medium text-gray-900 #{if i == 0, do: "max-w-0 w-full"} #{col[:class]}"
"px-6 py-3 whitespace-nowrap text-sm font-medium text-gray-900 #{col[:class]}"
}
>
<div class="flex items-center space-x-3 lg:pl-2">