aboutsummaryrefslogtreecommitdiff
path: root/test-apps/svg/src/app.gleam
blob: 4b0b8b29e689a1826fbd439809de1ba6400a79ad (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
import lustre
import lustre/attribute.{attribute}
import lustre/element/html
import lustre/element/svg
import lustre/ui
import lustre/ui/icon

pub fn main() {
  let styles = [#("width", "100vw"), #("height", "100vh"), #("padding", "1rem")]

  lustre.element(ui.centre(
    [attribute.style(styles)],
    html.svg(
      [
        attribute("version", "1.1"),
        attribute("viewBox", "0 0 300 200"),
        attribute("width", "300"),
        attribute("height", "200"),
      ],
      [
        svg.rect([
          attribute("width", "100%"),
          attribute("height", "100%"),
          attribute("fill", "red"),
        ]),
        svg.circle([
          attribute("cx", "150"),
          attribute("cy", "100"),
          attribute("r", "80"),
          attribute("fill", "green"),
        ]),
      ],
    ),
  ))
}