How would people convert the following code to heex?
<%= for {flash_key, flash_message} <- @flash do %>
<p class="alert alert-<%= flash_key %>" phx-click="lv:clear-flash">
<%= flash_message %>
</p>
<% end %>
I guess I could do:
<%= for {flash_key, flash_message} <- @flash do %>
<p class={"alert alert-#{flash_key}"} phx-click="lv:clear-flash">
<%= flash_message %>
</p>
<% end %>
But that seems kind of yuck too. Another potential solution, something like:
<%= for {flash_key, flash_message} <- @flash do %>
<%
classes =
["alert", "alert-#{flash_key}"]
|> Enum.join(" ")
%>
<p class={classes} phx-click="lv:clear-flash">
<%= flash_message %>
</p>
<% end %>
Still not sure I like it. Guess I could put the join in the function, not sure if that will help.
Just curious what other people would do in this situation, and what is considered good/acceptable.