stream-chat-react
Version:
React components to create chat conversations or livestream style chat
33 lines (32 loc) • 1.97 kB
TypeScript
import React from 'react';
import type { ChannelOrUserResponse } from './utils';
export type SearchResultsHeaderProps = Pick<SearchResultsProps, 'results'>;
export type SearchResultsListProps = Required<Pick<SearchResultsProps, 'results' | 'SearchResultItem' | 'selectResult'>> & {
focusedUser?: number;
};
export type SearchResultItemProps = Pick<SearchResultsProps, 'selectResult'> & {
index: number;
result: ChannelOrUserResponse;
focusedUser?: number;
};
export type SearchResultsController = {
results: Array<ChannelOrUserResponse>;
searching: boolean;
selectResult: (result: ChannelOrUserResponse) => Promise<void> | void;
};
export type AdditionalSearchResultsProps = {
/** Display search results as an absolutely positioned popup, defaults to false and shows inline */
popupResults?: boolean;
/** Custom UI component to display empty search results */
SearchEmpty?: React.ComponentType;
/** Custom UI component to display the search loading state */
SearchLoading?: React.ComponentType;
/** Custom UI component to display a search result list item, defaults to and accepts the same props as: [DefaultSearchResultItem](https://github.com/GetStream/stream-chat-react/blob/master/src/components/ChannelSearch/SearchResults.tsx) */
SearchResultItem?: React.ComponentType<SearchResultItemProps>;
/** Custom UI component to display the search results header */
SearchResultsHeader?: React.ComponentType;
/** Custom UI component to display all the search results, defaults to and accepts the same props as: [DefaultSearchResultsList](https://github.com/GetStream/stream-chat-react/blob/master/src/components/ChannelSearch/SearchResults.tsx) */
SearchResultsList?: React.ComponentType<SearchResultsListProps>;
};
export type SearchResultsProps = AdditionalSearchResultsProps & SearchResultsController;
export declare const SearchResults: (props: SearchResultsProps) => React.JSX.Element;