2024-09-11 00:52:18 +00:00
|
|
|
package base
|
|
|
|
|
|
|
|
|
|
import (
|
2024-09-14 00:05:55 +00:00
|
|
|
"github.com/maddalax/htmgo/framework/h"
|
2024-09-14 02:52:41 +00:00
|
|
|
"strings"
|
2024-09-11 00:52:18 +00:00
|
|
|
)
|
|
|
|
|
|
2024-09-14 02:52:41 +00:00
|
|
|
func Extensions() string {
|
2024-09-17 17:13:22 +00:00
|
|
|
extensions := []string{"path-deps", "response-targets", "mutation-error"}
|
|
|
|
|
if h.IsDevelopment() {
|
|
|
|
|
extensions = append(extensions, "livereload")
|
|
|
|
|
}
|
|
|
|
|
return strings.Join(extensions, ", ")
|
2024-09-14 02:52:41 +00:00
|
|
|
}
|
|
|
|
|
|
2024-09-11 23:41:21 +00:00
|
|
|
func RootPage(children ...h.Renderable) h.Renderable {
|
2024-09-11 00:52:18 +00:00
|
|
|
return h.Html(
|
2024-09-14 02:52:41 +00:00
|
|
|
h.HxExtension(Extensions()),
|
2024-09-11 00:52:18 +00:00
|
|
|
h.Head(
|
2024-09-13 01:42:18 +00:00
|
|
|
h.Link("/public/main.css", "stylesheet"),
|
2024-09-14 00:05:55 +00:00
|
|
|
h.Script("/public/htmgo.js"),
|
2024-09-11 00:52:18 +00:00
|
|
|
),
|
|
|
|
|
h.Body(
|
2024-09-11 17:31:40 +00:00
|
|
|
h.Div(
|
|
|
|
|
h.Class("flex flex-col gap-2 bg-white h-full"),
|
2024-09-11 00:52:18 +00:00
|
|
|
h.Fragment(children...),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
}
|