liveview for new member fields
This commit is contained in:
parent
abfc94473f
commit
6d426a21e8
4 changed files with 77 additions and 3 deletions
|
|
@ -673,4 +673,28 @@ defmodule MvWeb.CoreComponents do
|
|||
def translate_errors(errors, field) when is_list(errors) do
|
||||
for {^field, {msg, opts}} <- errors, do: translate_error({msg, opts})
|
||||
end
|
||||
|
||||
@doc """
|
||||
Renders a list of items with name and value pairs.
|
||||
|
||||
## Examples
|
||||
<.generic_list items={[
|
||||
{item.name, item.value},
|
||||
{other.name, other.value}
|
||||
]} />
|
||||
"""
|
||||
attr :items, :list, required: true, doc: "List of {name, value} tuples"
|
||||
|
||||
def generic_list(assigns) do
|
||||
~H"""
|
||||
<div class="mt-14">
|
||||
<dl class="-my-4 divide-y divide-zinc-100">
|
||||
<div :for={{name, value} <- @items} class="flex gap-4 py-4 text-sm leading-6 sm:gap-8">
|
||||
<dt class="w-1/4 flex-none text-zinc-500">{name}</dt>
|
||||
<dd class="text-zinc-700">{value}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue