Current section
Files
Jump to
Current section
Files
src/m3e/action_list.gleam
//// ActionList is a list of actions.
////
//// This file was generated by m3e/generator
////
//// DO NOT EDIT
////
import gleam/list
import lustre/attribute.{type Attribute}
import lustre/element.{type Element}
import m3e/attr
import m3e/list_variant.{type ListVariant}
// --- Types ---
/// ActionList is a View Model for this component
///
/// ## Fields:
///
/// - variant: The appearance variant of the list.
///
pub opaque type ActionList {
ActionList(variant: ListVariant)
}
// --- Defaults ---
pub const default_variant: ListVariant = list_variant.Standard
// --- Constructors ---
/// new creates a new ActionList with the default configuration.
///
pub fn new(variant: ListVariant) -> ActionList {
ActionList(variant: variant)
}
// --- Setters ---
/// variant sets the value of variant for this ActionList.
///
pub fn variant(_: ActionList, variant: ListVariant) -> ActionList {
ActionList(variant: variant)
}
// --- Renderers ---
/// render creates a Lustre Element for a ActionList
///
pub fn render(
model: ActionList,
attributes: List(Attribute(msg)),
children: List(Element(msg)),
) -> Element(msg) {
element.element(
"m3e-action-list",
list.flatten([
[
attr.with_default(
"variant",
list_variant.to_string(model.variant),
list_variant.to_string(default_variant),
),
],
attributes,
])
|> list.filter(fn(a) { a != attribute.none() }),
children,
)
}