Packages

🎨 Gleam UI lustre library by @gleam-br

Current section

Files

Jump to
gbr_ui src gbr@ui@admin@separator.erl
Raw

src/gbr@ui@admin@separator.erl

-module(gbr@ui@admin@separator).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src\\gbr\\ui\\admin\\separator.gleam").
-export([new/0, label/2, render/1]).
-export_type([u_i_separator/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
"\n"
" Gleam UI separator super element.\n"
"\n"
).
-opaque u_i_separator() :: default | {label, binary()}.
-file("src\\gbr\\ui\\admin\\separator.gleam", 23).
?DOC(" New separator super element default.\n").
-spec new() -> u_i_separator().
new() ->
default.
-file("src\\gbr\\ui\\admin\\separator.gleam", 29).
?DOC(" Set separator label.\n").
-spec label(u_i_separator(), binary()) -> u_i_separator().
label(_, Label) ->
{label, Label}.
-file("src\\gbr\\ui\\admin\\separator.gleam", 35).
?DOC(" Render separator super element to `lustre/element/html.{div}`.\n").
-spec render(u_i_separator()) -> lustre@vdom@vnode:element(any()).
render(In) ->
lustre@element@html:'div'(
[lustre@attribute:class(<<"relative py-3 sm:py-5"/utf8>>)],
[lustre@element@html:'div'(
[lustre@attribute:class(
<<"absolute inset-0 flex items-center"/utf8>>
)],
[lustre@element@html:'div'(
[lustre@attribute:class(
<<"w-full border-t border-gray-200 dark:border-gray-800"/utf8>>
)],
[]
)]
),
lustre@element@html:'div'(
[lustre@attribute:class(
<<"relative flex justify-center text-sm"/utf8>>
)],
[case In of
default ->
lustre@element:none();
{label, Text} ->
lustre@element@html:span(
[lustre@attribute:class(
<<"p-2 text-gray-400 bg-white dark:bg-gray-900 sm:px-5 sm:py-2"/utf8>>
)],
[lustre@element@html:text(Text)]
)
end]
)]
).