htmgo/examples/starter-template/pages/base/root.go
2024-09-22 21:33:22 -05:00

30 lines
595 B
Go

package base
import (
"github.com/maddalax/htmgo/framework/h"
"strings"
)
func Extensions() string {
extensions := []string{"path-deps", "response-targets", "mutation-error"}
if h.IsDevelopment() {
extensions = append(extensions, "livereload")
}
return strings.Join(extensions, ", ")
}
func RootPage(children ...h.Ren) h.Ren {
return h.Html(
h.HxExtension(Extensions()),
h.Head(
h.Link("/public/main.css", "stylesheet"),
h.Script("/public/htmgo.js"),
),
h.Body(
h.Div(
h.Class("flex flex-col gap-2 bg-white h-full"),
h.Fragment(children...),
),
),
)
}