package pages

import (
	h "git.codemonkeysoftware.net/b/hatmill"
	a "git.codemonkeysoftware.net/b/hatmill/attribute"
	e "git.codemonkeysoftware.net/b/hatmill/element"
)

func Head() h.ParentElement {
	return e.Head()(
		e.Meta(a.Charset("utf-8")),
		e.Meta(a.Name("viewport"), a.Content("width=device-width, initial-scale=1")),
		e.Title()(h.Text("Peachy")),
		e.Link(a.Rel("stylesheet"), a.Href("/static/css/main.css")),
		e.Link(a.Rel("icon"), a.Href("static/favicon.ico")),
		e.Script(a.Src("/static/js/htmx-2.0.3.min.js"))(), // TODO change to pack it with the app
	)
}

func Page[T h.Term](contents func() T) h.ParentElement {
	return e.Html()(
		Head(),
		e.Body()(
			contents(),
		),
	)
}
