aboutsummaryrefslogtreecommitdiff
path: root/test/input.gleam
diff options
context:
space:
mode:
Diffstat (limited to 'test/input.gleam')
-rw-r--r--test/input.gleam29
1 files changed, 12 insertions, 17 deletions
diff --git a/test/input.gleam b/test/input.gleam
index 61ce562..b2e85a9 100644
--- a/test/input.gleam
+++ b/test/input.gleam
@@ -4,8 +4,9 @@ import gleam/dynamic
import gleam/string
import lustre
import lustre/attribute.{attribute}
-import lustre/element.{Element}
+import lustre/element.{Element, t}
import lustre/event
+import lustre/html.{div, input, label, pre}
// MAIN ------------------------------------------------------------------------
@@ -56,24 +57,21 @@ fn update(model: Model, msg: Msg) -> Model {
// RENDER ----------------------------------------------------------------------
fn render(model: Model) -> Element(Msg) {
- element.div(
+ div(
[attribute.class("container")],
[
card([
email_input(model.email),
password_input(model.password),
remember_checkbox(model.remember_me),
- element.pre(
- [attribute.class("debug")],
- [element.text(string.inspect(model))],
- ),
+ pre([attribute.class("debug")], [t(string.inspect(model))]),
]),
],
)
}
fn card(content: List(Element(a))) -> Element(a) {
- element.div([attribute.class("card")], [element.div([], content)])
+ div([attribute.class("card")], [div([], content)])
}
fn email_input(value: String) -> Element(Msg) {
@@ -89,13 +87,13 @@ fn render_input(
type_: String,
id: String,
value: String,
- label: String,
+ text: String,
) -> Element(Msg) {
- element.div(
+ div(
[attribute.class("input")],
[
- element.label([attribute.for(id)], [element.text(label)]),
- element.input([
+ label([attribute.for(id)], [t(text)]),
+ input([
attribute.id(id),
attribute.name(id),
attribute.type_(type_),
@@ -108,10 +106,10 @@ fn render_input(
}
fn remember_checkbox(checked: Bool) -> Element(Msg) {
- element.div(
+ div(
[attribute.class("flex items-center")],
[
- element.input([
+ input([
attribute.id("remember-me"),
attribute.name("remember-me"),
attribute.type_("checkbox"),
@@ -119,10 +117,7 @@ fn remember_checkbox(checked: Bool) -> Element(Msg) {
attribute.class("checkbox"),
event.on_click(Toggled(RememberMe, !checked)),
]),
- element.label(
- [attribute.for("remember-me")],
- [element.text("Remember me")],
- ),
+ label([attribute.for("remember-me")], [t("Remember me")]),
],
)
}