diff options
Diffstat (limited to 'internal/components/results.templ')
-rw-r--r-- | internal/components/results.templ | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/internal/components/results.templ b/internal/components/results.templ deleted file mode 100644 index fee211c..0000000 --- a/internal/components/results.templ +++ /dev/null @@ -1,64 +0,0 @@ -package components - -import ( - "go.alanpearce.eu/searchix/internal/config" - "go.alanpearce.eu/searchix/internal/nix" - "strconv" -) - -func convertMatch[I nix.Importable](m nix.Importable) *I { - i, ok := m.(I) - if !ok { - return nil - } - return &i -} - -templ Results(r ResultData) { - if r.Query != "" { - if r.Results != nil && r.Results.Total > 0 { - if r.Source != nil { - switch r.Source.Importer { - case config.Options: - @Options(r.Results) - case config.Packages: - @Packages(r.Results) - } - } else { - @Combined(r.Results) - } - <footer aria-label="pagination"> - <nav id="pagination"> - if r.Prev != "" { - <a class="button" href={ templ.SafeURL(r.Prev) } rel="prev">Prev</a> - } - if r.Next != "" { - <a class="button" href={ templ.SafeURL(r.Next) } rel="next">Next</a> - } - </nav> - <span role="status">{ strconv.FormatUint(r.Results.Total, 10) } results</span> - if r.Next != r.Prev && r.Results.Total < config.MaxResultsShowAll { - <a href={ templ.SafeURL(r.All) }>Show All</a> - } - </footer> - } else { - <span role="status">Nothing found</span> - } - } else { - <br/> - } -} - -templ ResultsPage(r ResultData) { - @SearchPage(r.TemplateData, r) { - @Results(r) - } -} - -templ openDialogLink(attr string) { - <a class="open-dialog" href={ templ.SafeURL(attr) }>{ attr }</a> -} - -templ openCombinedDialogLink(attr string) { - <a class="open-dialog" href={ templ.SafeURL("/" + attr) }>{ attr }</a> -} |