Last active
September 28, 2022 08:02
-
-
Save mavuio/5d6730e0b501dc3dfb2a488cee3bc682 to your computer and use it in GitHub Desktop.
simple table template #elixir-heex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="flex space-x-4"> | |
<article> | |
<div class="mt-2 mb-4 text-xl font-bold">Rodents</div> | |
<table> | |
<thead class="[&>tr>*]:p-2 [&_th]:font-normal [&_th]:text-sm [&_th]:border [&_.num]:text-right "> | |
<tr> | |
<th>id</th> | |
<th>name</th> | |
<th class="num">price</th> | |
</tr> | |
<tr class=" total"> | |
<td></td> | |
<td>TOTAL</td> | |
<td class="num"> | |
<%= @items |> decimal_sum_for_field(:price) |> format_price() %> | |
</td> | |
</tr> | |
</thead> | |
<tbody class="[&>tr>td]:p-2 [&>tr>td]:border [&_.num]:text-right [&_a:hover]:underline"> | |
<%= for item <- @items do %> | |
<tr> | |
<td class="num"> | |
<.editlink item_id={item.id} context={@context}> | |
<%= item.id %> | |
</.editlink> | |
</td> | |
<td> | |
<.link navigate={ | |
Routes.rodent_path(@socket, :item_detail, item.id) | |
}> | |
<%= item.name %> | |
</.link> | |
</td> | |
<td class="num"><%= item.price |> format_price() %></td> | |
</tr> | |
<% end %> | |
</tbody> | |
</table> | |
</article> | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment