freedive/lib/liliform/title.ex

44 lines
782 B
Elixir
Raw Normal View History

2024-05-14 21:58:42 +02:00
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