Skip to content

Commit c43e585

Browse files
Merge branch 'main' into dc/backoffice-layout
2 parents b885a31 + 9a463ce commit c43e585

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
defmodule YearbookWeb.Components.EntryCard do
2+
@moduledoc """
3+
Entry Card Component.
4+
"""
5+
use Phoenix.Component
6+
import YearbookWeb.Components.Avatar
7+
8+
attr :src, :string, default: nil, doc: "The URL of the image to display."
9+
attr :name, :string, doc: "The name of the user."
10+
attr :text, :string, default: nil, doc: "Text."
11+
12+
def entry_card(assigns) do
13+
~H"""
14+
<div class="flex flex-col items-center gap-2 p-2 overflow-auto bg-white rounded-xl shadow-md w-full min-h-56 sm:min-h-72 lg:min-h-96">
15+
<div class="w-full shrink-0 overflow-hidden aspect-square sm:aspect-4/3">
16+
<%= if @src do %>
17+
<img
18+
src={@src}
19+
alt={@name}
20+
class="w-full h-full object-cover rounded-md"
21+
/>
22+
<% else %>
23+
<div class="flex items-center justify-center w-full h-full rounded-xl bg-gray-300 text-white font-bold text-2xl">
24+
{get_initials(@name)}
25+
</div>
26+
<% end %>
27+
</div>
28+
<h1 class="text-center w-full wrap-break-word font-bold px-2 text-md sm:text-lg lg:text-xl">
29+
{@name}
30+
</h1>
31+
<p class="flex-1 place-items-center p-2 text-sm sm:text-md lg:text-lg">{@text}</p>
32+
</div>
33+
"""
34+
end
35+
end

0 commit comments

Comments
 (0)