Add the my components and AuthorCard.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
e76eff8a46
commit
f9f10ca1f2
@ -0,0 +1,9 @@
|
|||||||
|
defmodule DecentralisedBookIndexWeb.Components.MyComponents do
|
||||||
|
alias DecentralisedBookIndexWeb.Components.MyComponents
|
||||||
|
|
||||||
|
defmacro __using__(_) do
|
||||||
|
quote do
|
||||||
|
import MyComponents.AuthorCard, only: [author_card: 1]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,24 @@
|
|||||||
|
defmodule DecentralisedBookIndexWeb.Components.MyComponents.AuthorCard do
|
||||||
|
use Phoenix.Component
|
||||||
|
|
||||||
|
attr(:author, :map, required: true)
|
||||||
|
|
||||||
|
def author_card(assigns) do
|
||||||
|
~H"""
|
||||||
|
<div class="w-full max-w-sm bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3">
|
||||||
|
<div class="flex flex-col items-center py-5">
|
||||||
|
<%= if @author.avatar_url != nil do %>
|
||||||
|
<img class="w-24 h-24 mb-3 rounded-full shadow-lg" src={@author.avatar_url} alt="Bonnie image"/>
|
||||||
|
<% else %>
|
||||||
|
<div class="relative w-36 h-36 overflow-hidden bg-gray-100 rounded-full dark:bg-gray-600">
|
||||||
|
<svg class="absolute w-36 h-36 text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"></path></svg>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<h5 class="mb-1 text-xl font-medium text-gray-900 dark:text-white">{@author.name}</h5>
|
||||||
|
<span class="text-sm text-gray-500 dark:text-gray-400">{@author.description}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue