This repository was archived by the owner on Jan 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDocument.fs
More file actions
executable file
·69 lines (51 loc) · 1.45 KB
/
Document.fs
File metadata and controls
executable file
·69 lines (51 loc) · 1.45 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/// BackPanel semantic document structure.
module rec BackPanel.Document
type ButtonType =
| Primary
| Warning
| Default
| Danger
| Success
| Inverse
| Info
| Link
| Disabled
type InputType =
| Enabled
| Disabled
[<AutoOpen>]
module Representation =
type Document = Box
type Box =
| Section of title: Inline * Document list
| Row of Column list
| Paragraph of Inline
| Checkbox of Inline * bool * obj
| Button of ButtonType * Inline * obj
| Input of InputType * string * string * (string -> obj)
| Table of header: Inline list * rows: Inline list list
type Columns = Column list
type Column =
| Column of Box list
/// One single line.
type Inline = InlineFragment list
type InlineFragment =
| Text of string
let (!!) text = Text(text)
/// Sections build a hierarchical document structure and are rendered as `h*` html elements.
let section title content =
Section(title, content)
let row content =
Row(content)
let column content =
Column(content)
let checkbox label state command =
Checkbox(label, state, box command)
let button buttonType label command =
Button(buttonType, label, command)
let input enabled placeholder content command =
Input(enabled, placeholder, content, command >> box)
let para content =
Paragraph content
let table header rows =
Table(header, rows)