aboutsummaryrefslogtreecommitdiff
path: root/test-apps/bool-property-toggle/src/app.gleam
blob: d18e1899afe12c93a4fc5888ec773a5870298261 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import lustre
import lustre/attribute
import lustre/effect
import lustre/element
import lustre/element/html
import lustre/event

pub type Model =
  Nil

fn init(_flags) -> #(Model, effect.Effect(Msg)) {
  #(Nil, effect.none())
}

pub type Msg {
  UserPressedButton
}

fn update(model: Model, msg: Msg) -> #(Model, effect.Effect(Msg)) {
  case msg {
    UserPressedButton -> {
      #(model, effect.none())
    }
  }
}

pub fn view(_model: Model) -> element.Element(Msg) {
  html.div([], [
    html.button([event.on_click(UserPressedButton)], [
      element.text("raise event"),
    ]),
    html.div([], [
      html.button([attribute.disabled(True)], [
        element.text("I should always be disabled"),
      ]),
    ]),
  ])
}

pub fn main() {
  let app = lustre.application(init, update, view)

  let assert Ok(_) = lustre.start(app, "#app", Nil)
  Nil
}