diff options
author | Alan Pearce | 2024-07-12 20:52:52 +0200 |
---|---|---|
committer | Alan Pearce | 2024-07-12 21:20:15 +0200 |
commit | 6781684647ad7f131054a93e1d13105d865c0e83 (patch) | |
tree | 307a688125f18128f582f7754af9a5451f0cb109 /internal/components/combined.templ | |
parent | 442345898802e93b0b884fd0f1c3492e08c34049 (diff) | |
download | searchix-6781684647ad7f131054a93e1d13105d865c0e83.tar.lz searchix-6781684647ad7f131054a93e1d13105d865c0e83.tar.zst searchix-6781684647ad7f131054a93e1d13105d865c0e83.zip |
feat: enable combined search
Diffstat (limited to 'internal/components/combined.templ')
-rw-r--r-- | internal/components/combined.templ | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/internal/components/combined.templ b/internal/components/combined.templ new file mode 100644 index 0000000..eeacdb5 --- /dev/null +++ b/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> +} |