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
|
2022-11-09 21:15:28 -05:00
|
|
|
alias Cannery.Tags.Tag
|
|
|
|
|
|
|
|
attr :tag, Tag, required: true
|
|
|
|
slot(:inner_block, required: true)
|
2022-02-05 01:59:40 -05:00
|
|
|
|
|
|
|
def tag_card(assigns) do
|
|
|
|
~H"""
|
|
|
|
<div
|
|
|
|
id={"tag-#{@tag.id}"}
|
2022-12-03 22:09:32 -05:00
|
|
|
class="mx-4 mb-4 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} />
|
2022-02-12 00:36:55 -05:00
|
|
|
<%= render_slot(@inner_block) %>
|
2022-02-05 01:59:40 -05:00
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
2022-02-18 22:56:46 -05:00
|
|
|
|
2022-11-09 21:15:28 -05:00
|
|
|
attr :tag, Tag, required: true
|
|
|
|
|
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
|