2022-02-05 01:59:40 -05:00
|
|
|
defmodule CanneryWeb.ContainerLive.ContainerCard do
|
|
|
|
@moduledoc """
|
|
|
|
Display card for a container
|
|
|
|
"""
|
|
|
|
|
|
|
|
use CanneryWeb, :component
|
|
|
|
alias CanneryWeb.Endpoint
|
|
|
|
|
|
|
|
def container_card(assigns) do
|
|
|
|
~H"""
|
|
|
|
<div
|
|
|
|
id={"container-#{@container.id}"}
|
|
|
|
class="px-8 py-4 flex flex-col justify-center items-center
|
|
|
|
border border-gray-400 rounded-lg shadow-lg hover:shadow-md"
|
|
|
|
>
|
|
|
|
<div class="mb-4 flex flex-col justify-center items-center">
|
|
|
|
<%= live_redirect to: Routes.container_show_path(Endpoint, :show, @container),
|
|
|
|
class: "link" do %>
|
|
|
|
<h1 class="px-4 py-2 rounded-lg title text-xl">
|
|
|
|
<%= @container.name %>
|
|
|
|
</h1>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= if @container.desc do %>
|
|
|
|
<span class="rounded-lg title text-lg">
|
2022-02-09 00:49:47 -05:00
|
|
|
<%= gettext("Description:") %>
|
|
|
|
<%= @container.desc %>
|
2022-02-05 01:59:40 -05:00
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<span class="rounded-lg title text-lg">
|
2022-02-09 00:49:47 -05:00
|
|
|
<%= gettext("Type:") %>
|
|
|
|
<%= @container.type %>
|
2022-02-05 01:59:40 -05:00
|
|
|
</span>
|
|
|
|
|
|
|
|
<%= if @container.location do %>
|
|
|
|
<span class="rounded-lg title text-lg">
|
2022-02-09 00:49:47 -05:00
|
|
|
<%= gettext("Location:") %>
|
|
|
|
<%= @container.location %>
|
2022-02-05 01:59:40 -05:00
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<%= if assigns |> Map.has_key?(:inner_block) do %>
|
|
|
|
<div class="flex space-x-4 justify-center items-center">
|
|
|
|
<%= render_slot(@inner_block) %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
end
|