quizterm/shared/src/components.gleam

27 lines
633 B
Gleam
Raw Normal View History

2026-04-11 14:11:11 +02:00
import gleam/int
import gleam/option.{type Option, None, Some}
import lustre/attribute.{class}
import lustre/element.{type Element}
import lustre/element/html
import lustre/event
pub fn click_cell(
tag: Option(String),
id_value_pair: #(String, String),
on_click: fn(String) -> msg,
) -> Element(msg) {
let #(id, value) = id_value_pair
html.div([class("participant-login"), event.on_click(on_click(id))], [
html.div([class("participant-name")], [
html.text(
""
<> case tag {
Some(text) -> "[#" <> text <> "] "
None -> ""
}
<> value,
),
]),
])
}