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"
|
2024-11-17 01:21:51 +00:00
|
|
|
"git.codemonkeysoftware.net/b/peachy-go"
|
|
|
|
"git.codemonkeysoftware.net/b/peachy-go/desktop/fields"
|
|
|
|
"git.codemonkeysoftware.net/b/peachy-go/hx"
|
2024-11-05 12:17:27 +00:00
|
|
|
)
|
|
|
|
|
2024-11-17 01:21:51 +00:00
|
|
|
func HomePage(db *peachy.DB) (func() h.ParentElement, error) {
|
|
|
|
siteName, err := db.SiteName()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
2024-11-05 12:17:27 +00:00
|
|
|
}
|
2024-11-17 01:21:51 +00:00
|
|
|
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
|
2024-11-05 12:17:27 +00:00
|
|
|
}
|
2024-11-15 18:55:31 +00:00
|
|
|
|
|
|
|
func Splash() h.Term {
|
|
|
|
return h.Terms{}
|
|
|
|
}
|