43 lines
941 B
Go
43 lines
941 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"
|
|
"git.codemonkeysoftware.net/b/peachy-go"
|
|
"git.codemonkeysoftware.net/b/peachy-go/desktop/fields"
|
|
"git.codemonkeysoftware.net/b/peachy-go/hx"
|
|
)
|
|
|
|
func HomePage(db *peachy.DB) (func() h.ParentElement, error) {
|
|
siteName, err := db.SiteName()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return func() h.ParentElement {
|
|
return e.Div()(
|
|
e.Input(
|
|
a.Type("text"),
|
|
a.Value(siteName),
|
|
a.Placeholder("site name"),
|
|
a.Name(fields.SiteName),
|
|
hx.Trigger("change"),
|
|
hx.Target("this"),
|
|
hx.Patch("/site"),
|
|
hx.Swap(hx.OuterHTML),
|
|
),
|
|
e.Button(
|
|
a.Type("button"),
|
|
hx.Get("/hello"),
|
|
hx.Trigger("click"),
|
|
hx.Target("#hello"),
|
|
)(h.Text("Click Here!")),
|
|
e.Div(a.Id("hello"))(),
|
|
)
|
|
}, nil
|
|
}
|
|
|
|
func Splash() h.Term {
|
|
return h.Terms{}
|
|
}
|