Render bio with linebreaks

This commit is contained in:
Claudio Ortolina
2024-12-03 00:33:37 +00:00
parent d1190e31f9
commit 9d02a8e00b
5 changed files with 12 additions and 4 deletions
@@ -49,4 +49,10 @@ defmodule MusicLibraryWeb.ArtistLive.Show do
wishlist: Enum.sort_by(wishlist, fn r -> r.release end, :desc)
}
end
defp render_bio(nil), do: gettext("Biography not available")
defp render_bio(bio) do
PhoenixHTMLHelpers.Format.text_to_html(bio, escape: false)
end
end
@@ -2,12 +2,12 @@
<h1 class="mt-1 flex font-semibold text-base lg:text-2xl leading-5 text-zinc-700 dark:text-zinc-300 text-wrap">
{@artist.name}
</h1>
<p
<div
:if={artist_info = @artist_info.ok? && @artist_info.result}
class="bio mt-2 text-sm leading-5 text-zinc-500 dark:text-zinc-400"
>
{(artist_info.bio || gettext("Biography not available")) |> raw()}
</p>
{render_bio(artist_info.bio)}
</div>
<div :if={@artist_records.collection !== []} class="mt-4">
<h2 class="font-semibold text-base sm:text-lg leading-5 text-zinc-700 dark:text-zinc-300">