cannery/lib/cannery_web/components/tag_card.ex

33 lines
771 B
Elixir
Raw Normal View History

2022-02-11 22:47:33 -05:00
defmodule CanneryWeb.Components.TagCard do
2022-02-05 01:59:40 -05:00
@moduledoc """
Display card for a tag
"""
use CanneryWeb, :component
def tag_card(assigns) do
~H"""
<div
id={"tag-#{@tag.id}"}
class="mx-4 my-2 px-8 py-4 space-x-4 flex justify-center items-center
2022-02-15 23:20:18 -05:00
border border-gray-400 rounded-lg shadow-lg hover:shadow-md
transition-all duration-300 ease-in-out"
2022-02-05 01:59:40 -05:00
>
2022-02-18 22:56:46 -05:00
<.simple_tag_card tag={@tag} />
<%= render_slot(@inner_block) %>
2022-02-05 01:59:40 -05:00
</div>
"""
end
2022-02-18 22:56:46 -05:00
def simple_tag_card(assigns) do
~H"""
<h1
2022-03-28 23:56:45 -04:00
class="inline-block break-all mx-2 my-1 px-4 py-2 rounded-lg title text-xl"
2022-02-18 22:56:46 -05:00
style={"color: #{@tag.text_color}; background-color: #{@tag.bg_color}"}
>
<%= @tag.name %>
</h1>
"""
end
2022-02-05 01:59:40 -05:00
end