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.
 
 
 
 
 

29 lines
886 B

defmodule MirageWeb.InboxLive.ItemComponent do
use MirageWeb, :live_component
def render(assigns) do
~L"""
<%= live_patch to: Routes.note_show_path(MirageWeb.Endpoint, :show, @note), class: "card" do %>
<span>
<i class="bi <%= type_icon(@type) %>"></i>
</span>
<span>
<strong><%= @note.title %></strong>
<p><%= @note.content |> String.slice(0..50) %>..</p>
<p class="tags">
<span class="tag">Views: <%= @note.views %></span>
<%= for topic <- @note.topics do %>
<span class="tag"><%= topic.text %></span>
<% end %>
</p>
</span>
<% end %>
"""
end
defp type_icon(:at), do: "bi-dice-4"
defp type_icon(:today), do: "bi-calendar-date"
defp type_icon(:untagged), do: "bi-tag"
defp type_icon(:unlinked), do: "bi-link-45deg"
defp type_icon(_), do: ""
end