peachy-go/desktop/pages/HomePage.go

46 lines
783 B
Go
Raw Normal View History

2024-11-05 12:17:27 +00:00
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()(
2024-11-15 18:55:31 +00:00
e.H1()(h.Text("[untitled]")),
2024-11-05 12:17:27 +00:00
e.Button(
a.Type("button"),
hxGet("/hello"),
hxTrigger("click"),
hxTarget("#hello"),
)(h.Text("Click Here!")),
e.Div(a.Id("hello"))(),
)
}
2024-11-15 18:55:31 +00:00
func Splash() h.Term {
return h.Terms{}
}