feat: enable combined search
1 file changed, 38 insertions(+), 0 deletions(-)
changed files
A internal/components/combined.templ
@@ -0,0 +1,38 @@ +package components + +import ( + "go.alanpearce.eu/searchix/internal/index" + "go.alanpearce.eu/searchix/internal/nix" +) + +templ Combined(result *index.Result) { + <table> + <thead> + <tr> + <th scope="col">Attribute</th> + <th scope="col">Description</th> + </tr> + </thead> + <tbody> + for _, hit := range result.Hits { + <tr> + <td> + @openCombinedDialogLink(nix.GetKey(hit.Data)) + </td> + <td> + switch hit.Data.(type) { + case nix.Option: + if o := convertMatch[nix.Option](hit.Data); o != nil { + @markdown(firstSentence(o.Description)) + } + case nix.Package: + if o := convertMatch[nix.Package](hit.Data); o != nil { + { firstSentence(o.Description) } + } + } + </td> + </tr> + } + </tbody> + </table> +}