[Enhancement] Render URL attributes as a link (#299)
* Render URLs as links when listing items from a map * Applies suggestions from MR feedback
This commit is contained in:
parent
8f91c4e6a2
commit
0d5a41fd35
1 changed files with 6 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ defmodule PinchflatWeb.CoreComponents do
|
|||
import PinchflatWeb.Gettext
|
||||
|
||||
alias Phoenix.LiveView.JS
|
||||
alias PinchflatWeb.CustomComponents.TextComponents
|
||||
|
||||
@doc """
|
||||
Renders a modal.
|
||||
|
|
@ -644,7 +645,11 @@ defmodule PinchflatWeb.CoreComponents do
|
|||
<li :for={{k, v} <- @iterable_attributes} class="mb-2 w-2/3">
|
||||
<strong><%= k %>:</strong>
|
||||
<code class="inline-block text-sm font-mono text-gray p-0.5 mx-0.5">
|
||||
<%= v %>
|
||||
<%= if is_binary(v) && URI.parse(v).scheme && URI.parse(v).scheme =~ "http" do %>
|
||||
<TextComponents.inline_link href={v}><%= v %></TextComponents.inline_link>
|
||||
<% else %>
|
||||
<%= v %>
|
||||
<% end %>
|
||||
</code>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Reference in a new issue