blob: 0b0bbe1fa04a96d4caf7cde53dd19fd389dc0c8a (
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
|
import gleam/io
import lustre
import lustre/attribute.{attribute}
import playground/monaco
pub type Action {
OnInput(String)
}
pub fn main() {
let init = "// Write some Gleam code here"
let update = fn(_, action) {
case action {
OnInput(input) -> io.debug(input)
}
}
let render = fn(state) {
monaco.render([
attribute("value", state),
monaco.on_change(fn(code, dispatch) { dispatch(OnInput(code)) }),
])
}
lustre.simple(init, update, render)
|> lustre.start("[data-lustre-container]")
}
|