freedive/lib/liliform/panel.ex

104 lines
1.9 KiB
Elixir

defmodule Liliform.Panel do
use Liliform.Component
@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 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