-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
alert.gleam
57 lines (45 loc) · 1.28 KB
/
alert.gleam
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
// IMPORTS ---------------------------------------------------------------------
import lustre/attribute.{type Attribute, attribute}
import lustre/element.{type Element}
import lustre/element/html
// ELEMENTS --------------------------------------------------------------------
///
///
pub fn alert(
attributes: List(Attribute(msg)),
children: List(Element(msg)),
) -> Element(msg) {
of(html.div, attributes, children)
}
///
///
pub fn of(
element: fn(List(Attribute(msg)), List(Element(msg))) -> Element(msg),
attributes: List(Attribute(msg)),
children: List(Element(msg)),
) -> Element(msg) {
element([attribute.class("lustre-ui-alert"), ..attributes], children)
}
// ATTRIBUTES ------------------------------------------------------------------
///
pub fn clear() -> Attribute(msg) {
attribute.class("clear")
}
pub fn primary() -> Attribute(msg) {
attribute("data-variant", "primary")
}
pub fn greyscale() -> Attribute(msg) {
attribute("data-variant", "greyscale")
}
pub fn error() -> Attribute(msg) {
attribute("data-variant", "error")
}
pub fn warning() -> Attribute(msg) {
attribute("data-variant", "warning")
}
pub fn success() -> Attribute(msg) {
attribute("data-variant", "success")
}
pub fn info() -> Attribute(msg) {
attribute("data-variant", "info")
}