refactor(search-react): move everything to alpha file

Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
Camila Belo
2023-09-28 09:37:16 +02:00
parent 184be50385
commit d36f92de24
5 changed files with 13 additions and 47 deletions
@@ -31,8 +31,8 @@ import { MockConfigApi } from '@backstage/test-utils';
import {
BaseSearchResultListItemProps,
createSearchResultListItemExtension,
searchResultItemExtensionData,
} from './createSearchResultListItemExtension';
searchResultItemExtensionData as searchResultListItemExtensionData,
} from './alpha';
// TODO: Remove this mock when we have a permanent solution for nav items extensions
// The `GraphiQLIcon` used in "packages/frontend-app-api/src/extensions/CoreNav.tsx" file
@@ -89,7 +89,7 @@ describe('createSearchResultListItemExtension', () => {
defaultPath: '/',
inputs: {
items: createExtensionInput({
item: searchResultItemExtensionData,
item: searchResultListItemExtensionData,
}),
},
loader: async ({ inputs }) => {
-17
View File
@@ -1,17 +0,0 @@
/*
* Copyright 2023 The Backstage Authors
*
* 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 * from './wiring';
@@ -28,7 +28,13 @@ import {
import { Progress } from '@backstage/core-components';
import { SearchDocument, SearchResult } from '@backstage/plugin-search-common';
import { SearchResultListItemExtension } from '../extensions';
import { SearchResultListItemExtension } from './extensions';
/** @alpha */
export type BaseSearchResultListItemProps<T = {}> = T & {
rank?: number;
result?: SearchDocument;
} & Omit<ListItemProps, 'button'>;
/** @alpha */
export type SearchResultItemExtensionComponent = <
@@ -77,12 +83,6 @@ export type SearchResultItemExtensionOptions<
predicate?: SearchResultItemExtensionPredicate;
};
/** @alpha */
export type BaseSearchResultListItemProps<T = {}> = T & {
rank?: number;
result?: SearchDocument;
} & Omit<ListItemProps, 'button'>;
/** @alpha */
export function createSearchResultListItemExtension<
TConfig extends { noTrack?: boolean },
@@ -92,7 +92,7 @@ export function createSearchResultListItemExtension<
? options.configSchema
: (createSchemaFromZod(z =>
z.object({
noTrack: z.boolean().default(true),
noTrack: z.boolean().default(false),
}),
) as PortableSchema<TConfig>);
return createExtension({
-17
View File
@@ -1,17 +0,0 @@
/*
* Copyright 2023 The Backstage Authors
*
* 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 * from './createSearchResultListItemExtension';