My space on the web https://inhji.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

34 lines
753 B

defmodule MirageWeb.SearchLive.SearchResultComponent do
use MirageWeb, :live_component
def icon(type) do
case type do
"note" -> "bi-journal-text"
"link" -> "bi-bookmark-star"
"tag" -> "bi-tag"
_ -> ""
end
end
def render(assigns) do
~L"""
<article>
<h2>
<strong>
<%= live_redirect to: @url do %>
<%= @result.title || @result.url %>
<% end %>
</strong>
</h2>
<p>
<%= raw @result.found_value %>
</p>
<footer>
<i class="bi <%= icon(@result.type) %>"></i> * Found in <strong><%= @result.found_prop %></strong> * <%= inspect(@result.occurrence) %>
</footer>
</article>
"""
end
end