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.Button(
			a.Type("button"),
			hxGet("/hello"),
			hxTrigger("click"),
			hxTarget("#hello"),
		)(h.Text("Click Here!")),
		e.Div(a.Id("hello"))(),
	)
}
