MCPcopy Create free account
hub / github.com/SyntaxUI/syntaxui / SearchResults

Function SearchResults

src/components/Search.tsx:232–270  ·  view source on GitHub ↗
({
  autocomplete,
  query,
  collection,
}: {
  autocomplete: Autocomplete
  query: string
  collection: AutocompleteCollection<Result>
})

Source from the content-addressed store, hash-verified

230}
231
232function SearchResults({
233 autocomplete,
234 query,
235 collection,
236}: {
237 autocomplete: Autocomplete
238 query: string
239 collection: AutocompleteCollection<Result>
240}) {
241 if (collection.items.length === 0) {
242 return (
243 <div className="p-6 text-center">
244 <NoResultsIcon className="mx-auto h-5 w-5 stroke-zinc-900 dark:stroke-zinc-600" />
245 <p className="mt-2 text-xs text-zinc-700 dark:text-zinc-400">
246 Nothing found for{' '}
247 <strong className="break-words font-semibold text-zinc-900 dark:text-white">
248 &lsquo;{query}&rsquo;
249 </strong>
250 . Please try again.
251 </p>
252 </div>
253 )
254 }
255
256 return (
257 <ul {...autocomplete.getListProps()}>
258 {collection.items.map((result, resultIndex) => (
259 <SearchResult
260 key={result.url}
261 result={result}
262 resultIndex={resultIndex}
263 autocomplete={autocomplete}
264 collection={collection}
265 query={query}
266 />
267 ))}
268 </ul>
269 )
270}
271
272const SearchInput = forwardRef<
273 React.ElementRef<'input'>,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected