all repos — searchix @ a1dfc548198a1326e71f1dd70303a5d3441f7a39

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

refactor: switch to templ for HTML templates

Alan Pearce
commit

a1dfc548198a1326e71f1dd70303a5d3441f7a39

parent

cac323d9ae70f55a43fd99b73e60cf614be11797

1 file changed, 34 insertions(+), 0 deletions(-)

changed files
A internal/components/options.templ
@@ -0,0 +1,34 @@
+package components + +import ( + "searchix/internal/index" + "searchix/internal/nix" +) + +templ Options(result *index.Result) { + <table> + <thead> + <tr> + <td scope="col">Title</td> + <td scope="col">Description</td> + </tr> + </thead> + <tbody> + for _, hit := range result.Hits { + @optionRow(hit.Data.(nix.Option)) + } + </tbody> + </table> +} + +templ optionRow(o nix.Option) { + <tr> + <td> + @openDialogLink(o.Name) + </td> + <td> + @markdown(firstSentence(o.Description)) + <dialog id={ o.Name }></dialog> + </td> + </tr> +}