Files
crowsnest/src/internal/html/layout.go

44 lines
1.2 KiB
Go
Raw Normal View History

2025-03-26 15:12:07 +01:00
package html
import (
g "maragu.dev/gomponents"
c "maragu.dev/gomponents/components"
h "maragu.dev/gomponents/html"
)
func Layout(title string, body g.Node) g.Node {
completeBody := []g.Node{
Navbar(),
h.Div(
h.Class("content container flex flex-col mx-auto px-4 mt-28"),
body,
),
h.Script(h.Src("https://cdn.tailwindcss.com")),
h.Script(
g.Text(
"up.link.config.followSelectors.push('a[href]')\n" +
"up.link.config.instantSelectors.push('a[href]')",
),
),
}
return c.HTML5(c.HTML5Props{
Title: title,
Language: "de",
Head: layoutHead(),
Body: completeBody,
HTMLAttrs: []g.Node{g.Attr("data-theme", "dark")},
})
}
func layoutHead() []g.Node {
return []g.Node{
h.Meta(h.Name("viewport"), h.Content("width=device-width, initial-scale=1")),
h.Link(h.Rel("stylesheet"), h.Type("text/css"), h.Href("/static/unpoly.min.css")),
h.Script(h.Src("/static/unpoly.min.js")),
h.Link(h.Rel("stylesheet"), h.Type("text/css"), h.Href("/static/daisyui.min.css")),
h.Script(h.Src("/static/tailwindcss.min.js")),
}
}