aboutsummaryrefslogtreecommitdiffstats
path: root/web/command/html/skeleton.go
blob: 9e174750c63a8305ac77cefcfc0bcf8e8d38d2b9 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package html

import (
	_ "embed"

	. "maragu.dev/gomponents"
	. "maragu.dev/gomponents/components"
	. "maragu.dev/gomponents/html"
)

//go:embed style.css
var styles string

func page(title string, children ...Node) Node {
	return HTML5(HTML5Props{
		Title:    title,
		Language: "en",
		Head: []Node{
			StyleEl(Raw(styles)),
		},
		Body: []Node{
			Div(Class("container"),
				Group(children),
				footer(),
			),
		},
	})
}

func footer() Node {
	return Footer(
		Hr(),
		Text("scrapbook"),
	)
}

func navButton(label string, dest string) Node {
	return A(
		Href(dest),
		Text(label),
	)
}

func alert(label string, class string) Node {
	return Div(
		Class("alert "+class),
		Text(label),
	)
}

func alertError(label string) Node {
	return alert(label, "error")
}

func alertSuccess(label string) Node {
	return alert(label, "success")
}