peachy-go/desktop/pages/HomePage.go

46 lines
783 B
Go

package pages
import (
h "git.codemonkeysoftware.net/b/hatmill"
a "git.codemonkeysoftware.net/b/hatmill/attribute"
e "git.codemonkeysoftware.net/b/hatmill/element"
)
func hxGet(url string) h.Attrib {
return h.Attrib{
Key: "hx-get",
Value: a.String(url),
}
}
func hxTrigger(event string) h.Attrib {
return h.Attrib{
Key: "hx-trigger",
Value: a.String(event),
}
}
func hxTarget(target string) h.Attrib {
return h.Attrib{
Key: "hx-target",
Value: a.String(target),
}
}
func HomePage() h.ParentElement {
return e.Div()(
e.H1()(h.Text("[untitled]")),
e.Button(
a.Type("button"),
hxGet("/hello"),
hxTrigger("click"),
hxTarget("#hello"),
)(h.Text("Click Here!")),
e.Div(a.Id("hello"))(),
)
}
func Splash() h.Term {
return h.Terms{}
}