Update the Book Show LiveView to show the cover image.
continuous-integration/drone/push Build is passing Details

dev
KKlochko 3 months ago
parent 9c89dec3cc
commit a7b6d64d40

@ -19,6 +19,17 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
</:actions>
</.header>
<div class="flex flex-wrap flex-[2_1_auto] gap-5">
<%= if @book.cover_image_url != nil do %>
<img class="w-36 shadow-lg mt-14 mx-auto md:mx-0 object-cover" src={@book.cover_image_url} alt={"#{@book.title} image"}/>
<% else %>
<div class="relative w-36 h-36 overflow-hidden mt-14 mx-auto md:mx-0">
<svg class="w-36 h-36 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
<path fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v15a3 3 0 0 0 3 3h12a1 1 0 1 0 0-2h-2v-2h2a1 1 0 0 0 1-1V4a2 2 0 0 0-2-2h-8v16h5v2H7a1 1 0 1 1 0-2h1V2H6Z" clip-rule="evenodd"/>
</svg>
</div>
<% end %>
<.list>
<:item title="Id">{@book.id}</:item>
@ -36,6 +47,8 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
<:item title="Cover image url">{@book.cover_image_url}</:item>
</.list>
</div>
<.back navigate={~p"/books"}>Back to books</.back>
"""

Loading…
Cancel
Save