44 lines
782 B
Elixir
44 lines
782 B
Elixir
|
defmodule Liliform.Title do
|
||
|
use Liliform.Component
|
||
|
|
||
|
@doc """
|
||
|
Renders a title.
|
||
|
"""
|
||
|
attr :class, :string, default: "", doc: "additional classes"
|
||
|
attr :rest, :global
|
||
|
|
||
|
slot :inner_block, required: true
|
||
|
|
||
|
def title(assigns) do
|
||
|
assigns =
|
||
|
assigns
|
||
|
|> set_bulma_classes()
|
||
|
|
||
|
~H"""
|
||
|
<h1 class={["title", @class]} {@rest}>
|
||
|
<%= render_slot(@inner_block) %>
|
||
|
</h1>
|
||
|
"""
|
||
|
end
|
||
|
|
||
|
@doc """
|
||
|
Renders a subtitle.
|
||
|
"""
|
||
|
attr :class, :string, default: "", doc: "additional classes"
|
||
|
attr :rest, :global
|
||
|
|
||
|
slot :inner_block, required: true
|
||
|
|
||
|
def subtitle(assigns) do
|
||
|
assigns =
|
||
|
assigns
|
||
|
|> set_bulma_classes()
|
||
|
|
||
|
~H"""
|
||
|
<h2 class={["subtitle", @class]} {@rest}>
|
||
|
<%= render_slot(@inner_block) %>
|
||
|
</h2>
|
||
|
"""
|
||
|
end
|
||
|
end
|