From 6da06d8c7beaccada5771c986d3b5d35d0946934 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Wed, 26 Mar 2025 11:49:55 +0200 Subject: [PATCH] Update the AuthorCard to allow edit and redirect to the show page. --- .../components/my_components/author_card.ex | 41 +++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/lib/decentralised_book_index_web/components/my_components/author_card.ex b/lib/decentralised_book_index_web/components/my_components/author_card.ex index a995cdb..b408f2b 100644 --- a/lib/decentralised_book_index_web/components/my_components/author_card.ex +++ b/lib/decentralised_book_index_web/components/my_components/author_card.ex @@ -1,21 +1,46 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.AuthorCard do use Phoenix.Component + use DecentralisedBookIndexWeb, :verified_routes attr(:author, :map, required: true) def author_card(assigns) do ~H"""
+
+ + + +
- <%= if @author.avatar_url != nil do %> - Bonnie image - <% else %> -
- -
- <% end %> + <.link navigate={~p"/authors/#{@author.id}"}> + <%= if @author.avatar_url != nil do %> + Bonnie image + <% else %> +
+ +
+ <% end %> + -
{@author.name}
+ <.link navigate={~p"/authors/#{@author.id}"}> +
{@author.name}
+ {@author.description}