aboutsummaryrefslogtreecommitdiffstats
path: root/web/command/html/skeleton.go
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.net>2025-07-08 23:26:05 +0100
committerLeonardo Bishop <me@leonardobishop.net>2025-07-08 23:26:05 +0100
commitcdb75d3fcbc9339b897f8c6ff4d69a577f017393 (patch)
tree5e757cd236540c2cea9874c1bc09f19548db05d5 /web/command/html/skeleton.go
parentb56101f1a11552067f594679a497ebd4cf7427d4 (diff)
Rewrite in Go
Diffstat (limited to 'web/command/html/skeleton.go')
-rw-r--r--web/command/html/skeleton.go57
1 files changed, 57 insertions, 0 deletions
diff --git a/web/command/html/skeleton.go b/web/command/html/skeleton.go
new file mode 100644
index 0000000..9e17475
--- /dev/null
+++ b/web/command/html/skeleton.go
@@ -0,0 +1,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")
+}