2022-02-12 02:28:27 -05:00
|
|
|
defmodule CanneryWeb.Components.UserCard do
|
|
|
|
@moduledoc """
|
|
|
|
Display card for a user
|
|
|
|
"""
|
|
|
|
|
|
|
|
use CanneryWeb, :component
|
2022-11-09 21:13:24 -05:00
|
|
|
alias Cannery.Accounts.User
|
|
|
|
|
|
|
|
attr :user, User, required: true
|
|
|
|
slot(:inner_block, required: true)
|
2022-02-12 02:28:27 -05:00
|
|
|
|
|
|
|
def user_card(assigns) do
|
|
|
|
~H"""
|
|
|
|
<div
|
|
|
|
id={"user-#{@user.id}"}
|
2022-02-19 19:54:48 -05:00
|
|
|
class="mx-4 my-2 px-8 py-4 flex flex-col justify-center items-center text-center
|
2022-02-15 23:20:18 -05:00
|
|
|
border border-gray-400 rounded-lg shadow-lg hover:shadow-md
|
|
|
|
transition-all duration-300 ease-in-out"
|
2022-02-12 02:28:27 -05:00
|
|
|
>
|
2022-02-15 23:52:44 -05:00
|
|
|
<h1 class="px-4 py-2 rounded-lg title text-xl break-all">
|
2022-02-12 02:28:27 -05:00
|
|
|
<%= @user.email %>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<h3 class="px-4 py-2 rounded-lg title text-lg">
|
2022-05-05 21:43:13 -04:00
|
|
|
<p>
|
|
|
|
<%= if @user.confirmed_at |> is_nil() do %>
|
|
|
|
Email unconfirmed
|
|
|
|
<% else %>
|
|
|
|
User was confirmed at <%= @user.confirmed_at |> display_datetime() %>
|
|
|
|
<% end %>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<%= gettext("User registered on") %>
|
|
|
|
<%= @user.inserted_at |> display_datetime() %>
|
|
|
|
</p>
|
2022-02-12 02:28:27 -05:00
|
|
|
</h3>
|
|
|
|
|
|
|
|
<%= if @inner_block do %>
|
|
|
|
<div class="px-4 py-2 flex space-x-4 justify-center items-center">
|
|
|
|
<%= render_slot(@inner_block) %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
end
|