toggleFilters(!showFilters)}
- />
- }
- />
-
-
- >
- );
+ return children({ results: value.results });
};
+
+export { SearchResultComponent as SearchResult };
diff --git a/plugins/search/src/components/SearchResult/index.tsx b/plugins/search/src/components/SearchResult/index.tsx
index cf10135fd0..407700c19c 100644
--- a/plugins/search/src/components/SearchResult/index.tsx
+++ b/plugins/search/src/components/SearchResult/index.tsx
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 Spotify AB
+ * Copyright 2021 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/plugins/search/src/components/SearchResultNext/SearchResultNext.tsx b/plugins/search/src/components/SearchResultNext/SearchResultNext.tsx
deleted file mode 100644
index 84d3759ad3..0000000000
--- a/plugins/search/src/components/SearchResultNext/SearchResultNext.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2021 Spotify AB
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import React from 'react';
-import { EmptyState, Progress } from '@backstage/core';
-import { SearchResult } from '@backstage/search-common';
-import { Alert } from '@material-ui/lab';
-
-import { useSearch } from '../SearchContext';
-
-type Props = {
- children: (results: { results: SearchResult[] }) => JSX.Element;
-};
-
-export const SearchResultNext = ({ children }: Props) => {
- const {
- result: { loading, error, value },
- } = useSearch();
-
- if (loading) {
- return ;
- }
- if (error) {
- return (
-
- Error encountered while fetching search results. {error.toString()}
-
- );
- }
-
- if (!value) {
- return ;
- }
-
- return children({ results: value.results });
-};
diff --git a/plugins/search/src/components/SearchResultNext/index.tsx b/plugins/search/src/components/SearchResultNext/index.tsx
deleted file mode 100644
index 73fabfdc7d..0000000000
--- a/plugins/search/src/components/SearchResultNext/index.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright 2021 Spotify AB
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { SearchResultNext } from './SearchResultNext';
diff --git a/plugins/search/src/components/index.tsx b/plugins/search/src/components/index.tsx
index 40d5c3603d..3032cda0b7 100644
--- a/plugins/search/src/components/index.tsx
+++ b/plugins/search/src/components/index.tsx
@@ -20,7 +20,6 @@ export * from './SearchBar';
export * from './SearchBarNext';
export * from './SearchPage';
export * from './SearchResult';
-export * from './SearchResultNext';
export * from './DefaultResultListItem';
export * from './SidebarSearch';
export * from './SearchContext';
diff --git a/plugins/search/src/index.ts b/plugins/search/src/index.ts
index 27fd1706fc..26f1c8f544 100644
--- a/plugins/search/src/index.ts
+++ b/plugins/search/src/index.ts
@@ -21,7 +21,7 @@ export {
SearchPage,
SearchPageNext,
SearchBarNext,
- SearchResultNext,
+ SearchResult,
DefaultResultListItem,
} from './plugin';
export {
@@ -32,7 +32,6 @@ export {
useSearch,
SearchPage as Router,
SearchFilterNext,
- SearchResult,
SidebarSearch,
} from './components';
export type { FiltersState } from './components';
diff --git a/plugins/search/src/plugin.ts b/plugins/search/src/plugin.ts
index 01abf38df9..24eb049d42 100644
--- a/plugins/search/src/plugin.ts
+++ b/plugins/search/src/plugin.ts
@@ -80,11 +80,24 @@ export const SearchBarNext = searchPlugin.provide(
}),
);
+export const SearchResult = searchPlugin.provide(
+ createComponentExtension({
+ component: {
+ lazy: () => import('./components/SearchResult').then(m => m.SearchResult),
+ },
+ }),
+);
+
+/**
+ * @deprecated This component was used for rapid prototyping of the Backstage
+ * Search platform. Now that the API has stabilized, you should use the
+ * component instead. This component will be removed in an
+ * upcoming release.
+ */
export const SearchResultNext = searchPlugin.provide(
createComponentExtension({
component: {
- lazy: () =>
- import('./components/SearchResultNext').then(m => m.SearchResultNext),
+ lazy: () => import('./components/SearchResult').then(m => m.SearchResult),
},
}),
);