use list for classes

This commit is contained in:
shibao 2023-01-25 23:13:16 -05:00
parent 1e4accec9d
commit 8ea2b06487
2 changed files with 4 additions and 4 deletions

View File

@ -4,7 +4,7 @@
<tr>
<%= for %{key: key, label: label} = column <- @columns do %>
<%= if column |> Map.get(:sortable, true) do %>
<th class={"p-2 #{column[:class]}"}>
<th class={["p-2", column[:class]]}>
<span
class="cursor-pointer flex justify-center items-center space-x-2"
phx-click="sort_by"
@ -26,7 +26,7 @@
</span>
</th>
<% else %>
<th class={"p-2 cursor-not-allowed #{column[:class]}"}>
<th class={["p-2 cursor-not-allowed", column[:class]]}>
<%= label %>
</th>
<% end %>
@ -37,7 +37,7 @@
<%= for {values, i} <- @rows |> Enum.with_index() do %>
<tr class={if i |> Integer.is_even(), do: @row_class, else: @alternate_row_class}>
<%= for %{key: key} = value <- @columns do %>
<td class={"p-2 #{value[:class]}"}>
<td class={["p-2", value[:class]]}>
<%= case values |> Map.get(key) do %>
<% {_custom_sort_value, value} -> %>
<%= value %>

View File

@ -18,7 +18,7 @@ defmodule CanneryWeb.ErrorHelpers do
~H"""
<%= for error <- Keyword.get_values(@form.errors, @field) do %>
<span class={"invalid-feedback #{@extra_class}"} phx-feedback-for={input_name(@form, @field)}>
<span class={["invalid-feedback", @extra_class]} phx-feedback-for={input_name(@form, @field)}>
<%= translate_error(error) %>
</span>
<% end %>