all repos — searchix @ ff1e9539fca1f011cfd52d0309a373f211c3fd10

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: wrap search form in semantic <search> element
Alan Pearce alan@alanpearce.eu
Wed, 19 Mar 2025 22:39:20 +0100
commit

ff1e9539fca1f011cfd52d0309a373f211c3fd10

parent

089cf8d9afc7edeb1cd00be4190f1bf8c63c5d14

4 files changed, 9 insertions(+), 10 deletions(-)

jump to
M go.modgo.mod
@@ -17,7 +17,7 @@ github.com/pelletier/go-toml/v2 v2.2.3 	github.com/stoewer/go-strcase v1.3.0
 	github.com/yuin/goldmark v1.7.8
 	gitlab.com/tozd/go/errors v0.10.0
-	go.alanpearce.eu/gomponents v1.2.0
+	go.alanpearce.eu/gomponents v1.3.0
 	go.alanpearce.eu/x v0.0.0-20241203124832-a29434dba11a
 	go.uber.org/zap v1.27.0
 	golang.org/x/net v0.33.0
M go.sumgo.sum
@@ -140,8 +140,8 @@ github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic= github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
 gitlab.com/tozd/go/errors v0.10.0 h1:A98kL+gaDvWnY6ZB/u8zP+sYaWsWUGBHeFMtamvW/74=
 gitlab.com/tozd/go/errors v0.10.0/go.mod h1:q3Ugr0C8dCzMEkrzjjlV2qNsm9e0KvqBjwcbcjCpBe4=
-go.alanpearce.eu/gomponents v1.2.0 h1:5SoLlMMc04xvLcmHVgnScjX1DzBM4mbwyTDa0cOPiD8=
-go.alanpearce.eu/gomponents v1.2.0/go.mod h1:uX96UAsHCut1cKMAYVWWxQ9ADt1CAPI8LpyAu0LRQPs=
+go.alanpearce.eu/gomponents v1.3.0 h1:yfrDWy77KF/ohDLmgNNud1hMR9WWOvCZJlfyO4SSDo4=
+go.alanpearce.eu/gomponents v1.3.0/go.mod h1:uX96UAsHCut1cKMAYVWWxQ9ADt1CAPI8LpyAu0LRQPs=
 go.alanpearce.eu/x v0.0.0-20241203124832-a29434dba11a h1:NUv3AzGxwMVSq26takww8/nyl+sPO2BsESoVSU8G49U=
 go.alanpearce.eu/x v0.0.0-20241203124832-a29434dba11a/go.mod h1:FRM6J9HMQ/RV2Q5j+6RKBYWh/YNeEUriGSqDRchiHuQ=
 go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0=
M gomod2nix.tomlgomod2nix.toml
@@ -152,8 +152,8 @@ [mod."gitlab.com/tozd/go/errors"]     version = "v0.10.0"
     hash = "sha256-oW37KsieVKJOWk9ZXbGuQvuU4nyJCZzgYrTZHFkoCs4="
   [mod."go.alanpearce.eu/gomponents"]
-    version = "v1.2.0"
-    hash = "sha256-pF+3We63loSMwhTUafgIdmBYc4cj5yVIVQRyaX1sWB4="
+    version = "v1.3.0"
+    hash = "sha256-rZz5rJdm58axukN6RlaVKSJ9v2TPngIHt3P1APpXSxY="
   [mod."go.alanpearce.eu/x"]
     version = "v0.0.0-20241203124832-a29434dba11a"
     hash = "sha256-ojqWkz3VqeAOevFxOTO5S3acRItCA4pUrTaul887+x8="
M internal/components/search.gointernal/components/search.go
@@ -7,10 +7,9 @@ g "go.alanpearce.eu/gomponents" 	. "go.alanpearce.eu/gomponents/html"
 )
 
-func Search(tdata TemplateData, r ResultData) g.Node {
-	return Form(
+func SearchForm(tdata TemplateData, r ResultData) g.Node {
+	return Search(Form(
 		ID("search"),
-		Role("search"),
 		FieldSet(
 			Legend(
 				ID("legend"),
@@ -28,7 +27,7 @@ g.Attr("autocapitalize", "none"), 			),
 			Button(g.Text("Search")),
 		),
-	)
+	))
 }
 
 func SearchPage(tdata TemplateData, r ResultData, children ...g.Node) g.Node {
@@ -77,7 +76,7 @@ g.Text("."), 			),
 		),
 		script(tdata.Assets.ByPath["/static/search.js"]),
-		Search(tdata, r),
+		SearchForm(tdata, r),
 		Section(
 			ID("results"),
 			Role("list"),