From 6781684647ad7f131054a93e1d13105d865c0e83 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 Jul 2024 20:52:52 +0200 Subject: feat: enable combined search --- internal/components/combined.templ | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 internal/components/combined.templ (limited to 'internal/components/combined.templ') 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) { +
Attribute | +Description | +
---|---|
+ @openCombinedDialogLink(nix.GetKey(hit.Data)) + | ++ 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) } + } + } + | +