freedive/lib/liliform/media.ex

81 lines
1.3 KiB
Elixir
Raw Normal View History

2024-05-14 21:58:42 +02:00
defmodule Liliform.Media do
use Liliform.Component
@doc """
Renders a media object.
"""
attr :class, :string, default: "", doc: "additional classes"
attr :rest, :global
slot :inner_block, required: true
def media(assigns) do
assigns =
assigns
|> set_bulma_classes()
~H"""
<article class={["media", @class]} {@rest}>
<%= render_slot(@inner_block) %>
</article>
"""
end
@doc """
Renders a media-left.
"""
attr :rest, :global
slot :inner_block, required: true
def media_left(assigns) do
assigns =
assigns
|> set_bulma_classes()
~H"""
<figure class="media-left" {@rest}>
<%= render_slot(@inner_block) %>
</figure>
"""
end
@doc """
Renders a media-content.
"""
attr :rest, :global
slot :inner_block, required: true
def media_content(assigns) do
assigns =
assigns
|> set_bulma_classes()
~H"""
<div class="media-content" {@rest}>
<%= render_slot(@inner_block) %>
</div>
"""
end
@doc """
Renders a media-right.
"""
attr :rest, :global
slot :inner_block, required: true
def media_right(assigns) do
assigns =
assigns
|> set_bulma_classes()
~H"""
<div class="media-right" {@rest}>
<%= render_slot(@inner_block) %>
</div>
"""
end
end