From 4999884f7de9e8319332b0c65a8a54a09e374432 Mon Sep 17 00:00:00 2001 From: breakid Date: Sun, 30 Jun 2024 17:59:47 -0400 Subject: [PATCH] Render URLs as links when listing items from a map --- lib/pinchflat_web/components/core_components.ex | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/pinchflat_web/components/core_components.ex b/lib/pinchflat_web/components/core_components.ex index 58f785c..7279e28 100644 --- a/lib/pinchflat_web/components/core_components.ex +++ b/lib/pinchflat_web/components/core_components.ex @@ -644,7 +644,13 @@ defmodule PinchflatWeb.CoreComponents do
  • <%= k %>: - <%= v %> + <%= if is_binary(v) and String.starts_with?(v, "http") do %> + <.link class="underline decoration-bodydark decoration-1 hover:decoration-white" href={v} target="_blank"> + <%= v %> + + <% else %> + <%= v %> + <% end %>