27 lines
633 B
Gleam
27 lines
633 B
Gleam
|
|
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,
|
||
|
|
),
|
||
|
|
]),
|
||
|
|
])
|
||
|
|
}
|