forked from hiway/freedive
83 lines
1.5 KiB
Elixir
83 lines
1.5 KiB
Elixir
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 :class, :string, default: "", doc: "additional classes"
|
|
attr :rest, :global
|
|
|
|
slot :inner_block, required: true
|
|
|
|
def media_left(assigns) do
|
|
assigns =
|
|
assigns
|
|
|> set_bulma_classes()
|
|
|
|
~H"""
|
|
<figure class={["media-left", @class]} {@rest}>
|
|
<%= render_slot(@inner_block) %>
|
|
</figure>
|
|
"""
|
|
end
|
|
|
|
@doc """
|
|
Renders a media-content.
|
|
"""
|
|
attr :class, :string, default: "", doc: "additional classes"
|
|
attr :rest, :global
|
|
|
|
slot :inner_block, required: true
|
|
|
|
def media_content(assigns) do
|
|
assigns =
|
|
assigns
|
|
|> set_bulma_classes()
|
|
|
|
~H"""
|
|
<div class={["media-content", @class]} {@rest}>
|
|
<%= render_slot(@inner_block) %>
|
|
</div>
|
|
"""
|
|
end
|
|
|
|
@doc """
|
|
Renders a media-right.
|
|
"""
|
|
attr :class, :string, default: "", doc: "additional classes"
|
|
attr :rest, :global
|
|
|
|
slot :inner_block, required: true
|
|
|
|
def media_right(assigns) do
|
|
assigns =
|
|
assigns
|
|
|> set_bulma_classes()
|
|
|
|
~H"""
|
|
<div class={["media-right", @class]} {@rest}>
|
|
<%= render_slot(@inner_block) %>
|
|
</div>
|
|
"""
|
|
end
|
|
end
|