136 lines
2.6 KiB
Elixir
136 lines
2.6 KiB
Elixir
defmodule Liliform.Panel do
|
|
use Liliform.Component
|
|
import Liliform.Media
|
|
|
|
@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()
|
|
|
|
~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()
|
|
|
|
~H"""
|
|
<div class={["panel-block", @class]} {@rest}>
|
|
<%= render_slot(@inner_block) %>
|
|
</div>
|
|
"""
|
|
end
|
|
|
|
@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}>
|
|
<.media>
|
|
<.media_left>
|
|
<%= render_slot(@icon) %>
|
|
</.media_left>
|
|
<.media_content>
|
|
<%= render_slot(@inner_block) %>
|
|
</.media_content>
|
|
<.media_right>
|
|
<%= render_slot(@actions) %>
|
|
</.media_right>
|
|
</.media>
|
|
</div>
|
|
"""
|
|
end
|
|
|
|
@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
|