-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspinner.go
53 lines (43 loc) · 1.08 KB
/
spinner.go
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
package components
import (
"fmt"
lucide "github.com/eduardolat/gomponents-lucide"
"github.com/maragudk/gomponents"
"github.com/maragudk/gomponents/html"
)
func Spinner(size string) gomponents.Node {
return lucide.LoaderCircle(Classes{
"animate-spin inline-block": true,
"w-5 h-5": size == "sm",
"w-8 h-8": size == "md",
"w-12 h-12": size == "lg",
})
}
func SpinnerSm() gomponents.Node {
return Spinner("sm")
}
func SpinnerMd() gomponents.Node {
return Spinner("md")
}
func SpinnerLg() gomponents.Node {
return Spinner("lg")
}
func SpinnerContainer(size string, height string) gomponents.Node {
return html.Div(
Classes{
"flex justify-center": true,
"items-center w-full": true,
},
html.Style(fmt.Sprintf("height: %s;", height)),
Spinner(size),
)
}
func SpinnerContainerSm() gomponents.Node {
return SpinnerContainer("sm", "300px")
}
func SpinnerContainerMd() gomponents.Node {
return SpinnerContainer("md", "300px")
}
func SpinnerContainerLg() gomponents.Node {
return SpinnerContainer("lg", "300px")
}