changeset and api report updates

Co-authored-by: Camila Loiola <camilaibs@gmail.com>
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
Emma Indal
2022-09-30 15:08:05 +02:00
committed by Camila Belo
parent 6cbe962a5f
commit 6faaa05626
2 changed files with 47 additions and 5 deletions
+30
View File
@@ -0,0 +1,30 @@
---
'@backstage/plugin-search-react': minor
---
The `<SearchResultGroup />` component now accepts an optional property `disableRenderingWithNoResults` to disable rendering when no results are returned.
Possibility to provide a custom no results component if needed through the `noResultsComponent` property.
Examples:
_Rendering a custom no results component_
```jsx
<SearchResultGroup
query={query}
icon={<DocsIcon />}
title="Documentation"
noResultsComponent={<ListItemText primary="No results were found" />}
/>
```
_Disable rendering when there are no results_
```jsx
<SearchResultGroup
query={query}
icon={<DocsIcon />}
title="Documentation"
disableRenderingWithNoResults
/>
```
+17 -5
View File
@@ -213,7 +213,9 @@ export type SearchFilterWrapperProps = SearchFilterComponentProps & {
export const SearchResult: (props: SearchResultProps) => JSX.Element;
// @public
export const SearchResultApi: (props: SearchResultApiProps) => JSX.Element;
export const SearchResultApi: (
props: SearchResultApiProps,
) => JSX.Element | null;
// @public
export type SearchResultApiProps = SearchResultContextProps & {
@@ -226,11 +228,11 @@ export const SearchResultComponent: (props: SearchResultProps) => JSX.Element;
// @public
export const SearchResultContext: (
props: SearchResultContextProps,
) => JSX.Element;
) => JSX.Element | null;
// @public
export type SearchResultContextProps = {
children: (state: AsyncState<SearchResultSet>) => JSX.Element;
children: (state: AsyncState<SearchResultSet>) => JSX.Element | null;
};
// @public
@@ -269,13 +271,22 @@ export type SearchResultGroupLayoutProps<FilterOption> = ListProps & {
link?: ReactNode;
linkProps?: Partial<LinkProps>;
filterOptions?: FilterOption[];
renderFilterOption?: (filterOption: FilterOption) => JSX.Element;
renderFilterOption?: (
value: FilterOption,
index: number,
array: FilterOption[],
) => JSX.Element | null;
filterFields?: string[];
renderFilterField?: (key: string) => JSX.Element | null;
resultItems?: SearchResult_2[];
renderResultItem?: (resultItem: SearchResult_2) => JSX.Element;
renderResultItem?: (
value: SearchResult_2,
index: number,
array: SearchResult_2[],
) => JSX.Element | null;
error?: Error;
loading?: boolean;
noResultsComponent?: ReactNode;
};
// @public
@@ -284,6 +295,7 @@ export type SearchResultGroupProps<FilterOption> = Omit<
'loading' | 'error' | 'resultItems' | 'filterFields'
> & {
query: Partial<SearchQuery>;
disableRenderingWithNoResults?: boolean;
};
// @public