From a7b6d64d40b011ae59063759aa5c5019181ee0a0 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Sun, 30 Mar 2025 19:48:17 +0300 Subject: [PATCH] Update the Book Show LiveView to show the cover image. --- .../live/book_live/show.ex | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/lib/decentralised_book_index_web/live/book_live/show.ex b/lib/decentralised_book_index_web/live/book_live/show.ex index 9f3d60e..1fedbf0 100644 --- a/lib/decentralised_book_index_web/live/book_live/show.ex +++ b/lib/decentralised_book_index_web/live/book_live/show.ex @@ -19,23 +19,36 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do - <.list> - <:item title="Id">{@book.id} +
+ <%= if @book.cover_image_url != nil do %> + {"#{@book.title} + <% else %> +
+ +
+ <% end %> - <:item title="Title">{@book.title} + <.list> + <:item title="Id">{@book.id} - <:item title="Description">{@book.description} + <:item title="Title">{@book.title} - <:item title="Published">{@book.published} + <:item title="Description">{@book.description} - <:item title="Language">{@book.language} + <:item title="Published">{@book.published} - <:item title="Format">{@book.format} + <:item title="Language">{@book.language} - <:item title="Page count">{@book.page_count} + <:item title="Format">{@book.format} + + <:item title="Page count">{@book.page_count} + + <:item title="Cover image url">{@book.cover_image_url} + +
- <:item title="Cover image url">{@book.cover_image_url} - <.back navigate={~p"/books"}>Back to books """