htmgo/starter-template/pages/news.index.go

30 lines
693 B
Go
Raw Normal View History

2024-09-11 00:52:18 +00:00
package pages
import (
"github.com/gofiber/fiber/v2"
2024-09-13 17:13:01 +00:00
"github.com/maddalax/mhtml/framework/h"
"github.com/maddalax/mhtml/starter-template/pages/base"
"github.com/maddalax/mhtml/starter-template/partials"
2024-09-11 00:52:18 +00:00
)
func ListPage(ctx *fiber.Ctx) *h.Page {
return h.NewPage(base.RootPage(
2024-09-11 17:31:40 +00:00
list(ctx),
2024-09-11 00:52:18 +00:00
))
}
func list(ctx *fiber.Ctx) h.Renderable {
2024-09-11 00:52:18 +00:00
return h.Fragment(
2024-09-11 17:31:40 +00:00
h.ViewOnLoad(partials.NewsSheet),
2024-09-11 00:52:18 +00:00
h.Div(
h.Class("inline-flex flex-col gap-4 p-4"),
h.Div(
h.Class("max-w-md flex flex-col gap-4 "),
2024-09-11 17:31:40 +00:00
partials.OpenSheetButton(h.GetQueryParam(ctx, "open") == "true"),
2024-09-11 00:52:18 +00:00
),
h.Div(
2024-09-11 17:31:40 +00:00
h.ViewOnLoad(partials.NewsSheetOpenCount),
2024-09-11 00:52:18 +00:00
h.Text("you opened sheet 0 times")),
))
}