2024-05-14 21:58:42 +02:00
|
|
|
defmodule Liliform.Panel do
|
|
|
|
use Liliform.Component
|
2024-05-16 12:44:28 +02:00
|
|
|
import Liliform.Media
|
2024-05-14 21:58:42 +02:00
|
|
|
|
|
|
|
@doc """
|
|
|
|
Renders a panel.
|
|
|
|
"""
|
|
|
|
attr :class, :string, default: "", doc: "additional classes"
|
|
|
|
attr :rest, :global
|
|
|
|
|
|
|
|
slot :inner_block, required: true
|
|
|
|
|
|
|
|
def panel(assigns) do
|
|
|
|
assigns =
|
|
|
|
assigns
|
|
|
|
|> set_bulma_classes()
|
|
|
|
|
|
|
|
~H"""
|
|
|
|
<nav class={["panel", @class]} {@rest}>
|
|
|
|
<%= render_slot(@inner_block) %>
|
|
|
|
</nav>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
Renders a panel-heading.
|
|
|
|
"""
|
|
|
|
attr :class, :string, default: "", doc: "additional classes"
|
|
|
|
attr :rest, :global
|
|
|
|
|
|
|
|
slot :inner_block, required: true
|
|
|
|
|
|
|
|
def panel_heading(assigns) do
|
|
|
|
assigns =
|
|
|
|
assigns
|
|
|
|
|> set_bulma_classes()
|
|
|
|
|
|
|
|
~H"""
|
|
|
|
<p class={["panel-heading", @class]} {@rest}>
|
|
|
|
<%= render_slot(@inner_block) %>
|
|
|
|
</p>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
Renders a panel-block.
|
|
|
|
"""
|
|
|
|
attr :class, :string, default: "", doc: "additional classes"
|
|
|
|
attr :rest, :global
|
|
|
|
|
|
|
|
slot :inner_block, required: true
|
|
|
|
|
|
|
|
def panel_block(assigns) do
|
|
|
|
assigns =
|
|
|
|
assigns
|
|
|
|
|> set_bulma_classes()
|
|
|
|
|
2024-05-16 03:56:54 +02:00
|
|
|
~H"""
|
|
|
|
<a class={["panel-block", @class]} {@rest}>
|
|
|
|
<%= render_slot(@inner_block) %>
|
|
|
|
</a>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
Renders a panel-block-div.
|
|
|
|
"""
|
|
|
|
attr :class, :string, default: "", doc: "additional classes"
|
|
|
|
attr :rest, :global
|
|
|
|
|
|
|
|
slot :inner_block, required: true
|
|
|
|
|
|
|
|
def panel_block_div(assigns) do
|
|
|
|
assigns =
|
|
|
|
assigns
|
|
|
|
|> set_bulma_classes()
|
|
|
|
|
2024-05-14 21:58:42 +02:00
|
|
|
~H"""
|
|
|
|
<div class={["panel-block", @class]} {@rest}>
|
|
|
|
<%= render_slot(@inner_block) %>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
|
2024-05-16 12:44:28 +02:00
|
|
|
@doc """
|
|
|
|
Renders panel-media.
|
|
|
|
"""
|
|
|
|
attr :class, :string, default: "", doc: "additional classes"
|
|
|
|
attr :rest, :global
|
|
|
|
|
|
|
|
slot :icon, required: true
|
|
|
|
slot :actions, required: true
|
|
|
|
slot :inner_block, required: true
|
|
|
|
|
|
|
|
def panel_media(assigns) do
|
|
|
|
assigns =
|
|
|
|
assigns
|
|
|
|
|> set_bulma_classes()
|
|
|
|
|
|
|
|
~H"""
|
|
|
|
<div class={["panel-block", @class]} {@rest}>
|
2024-05-18 14:06:14 +02:00
|
|
|
<.media>
|
2024-05-16 12:44:28 +02:00
|
|
|
<.media_left>
|
|
|
|
<%= render_slot(@icon) %>
|
|
|
|
</.media_left>
|
2024-05-18 14:06:14 +02:00
|
|
|
<.media_content>
|
2024-05-16 12:44:28 +02:00
|
|
|
<%= render_slot(@inner_block) %>
|
|
|
|
</.media_content>
|
|
|
|
<.media_right>
|
|
|
|
<%= render_slot(@actions) %>
|
|
|
|
</.media_right>
|
|
|
|
</.media>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
2024-05-16 03:56:54 +02:00
|
|
|
|
2024-05-14 21:58:42 +02:00
|
|
|
@doc """
|
|
|
|
Renders a panel-tabs.
|
|
|
|
"""
|
|
|
|
attr :class, :string, default: "", doc: "additional classes"
|
|
|
|
attr :rest, :global
|
|
|
|
|
|
|
|
slot :inner_block, required: true
|
|
|
|
|
|
|
|
def panel_tabs(assigns) do
|
|
|
|
assigns =
|
|
|
|
assigns
|
|
|
|
|> set_bulma_classes()
|
|
|
|
|
|
|
|
~H"""
|
|
|
|
<p class={["panel-tabs", @class]} {@rest}>
|
|
|
|
<%= render_slot(@inner_block) %>
|
|
|
|
</p>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
end
|