MCPcopy
hub / github.com/github/docs / SearchResults

Function SearchResults

components/search/SearchResults.tsx:19–38  ·  view source on GitHub ↗
({ results, query }: Props)

Source from the content-addressed store, hash-verified

17 query: string
18}
19export function SearchResults({ results, query }: Props) {
20 const { t } = useTranslation('search')
21 const { formatInteger } = useNumberFormatter()
22
23 const pages = Math.ceil(results.meta.found.value / results.meta.size)
24 const { page } = results.meta
25
26 return (
27 <div>
28 <Text>
29 {results.meta.found.value === 1
30 ? t('one_result')
31 : t('n_results').replace('{n}', formatInteger(results.meta.found.value))}
32 </Text>
33 <br />
34 <SearchResultHits hits={results.hits} query={query} />
35 {pages > 1 && <ResultsPagination page={page} totalPages={pages} />}
36 </div>
37 )
38}
39
40function SearchResultHits({ hits, query }: { hits: SearchResultHitT[]; query: string }) {
41 const { debug } = useQuery()

Callers

nothing calls this directly

Calls 2

useTranslationFunction · 0.90
useNumberFormatterFunction · 0.90

Tested by

no test coverage detected