aboutsummaryrefslogtreecommitdiff
path: root/test/apps/static.gleam
blob: fcf52f3a02cde2b2b3102bbb5bd9e9e706ac14ee (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
// IMPORTS ---------------------------------------------------------------------

import lustre/attribute.{attribute, class, disabled, src, style}
import lustre/element.{text}
import lustre/element/html.{body, div, h1, head, html, img, input, title}

// VIEW ------------------------------------------------------------------------

pub fn view() {
  html([], [
    head([], [title([], "Hello, World!")]),
    body([], [
      h1([], [text("Hello, World!")]),
      input([disabled(True)]),
      img([src("https://source.unsplash.com/random")]),
    ]),
  ])
}

pub fn escaped_attribute() {
  div(
    [
      class("'badquotes'"),
      style([#("background", "\"><script>alert`1`</script>")]),
      attribute("example", "{\"mykey\": \"myvalue\"}"),
    ],
    [],
  )
}