feat: small refactor for the search package

Co-authored-by: Fredrik Adelöw <freben@users.noreply.github.com>
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-08-14 14:44:13 +02:00
parent 8f8519d94e
commit 4c39af8902
11 changed files with 561 additions and 21 deletions
@@ -27,8 +27,9 @@ import {
import {
SearchResultListItemExtension,
SearchResultListItemExtensionProps,
} from '../extensions';
} from '../../extensions';
/** @alpha */
export interface SearchResultListItemBlueprintParams {
/**
* The extension component.
@@ -43,6 +44,10 @@ export interface SearchResultListItemBlueprintParams {
predicate?: SearchResultItemExtensionPredicate;
}
/**
* @alpha
* Creates SearchResultListItem extensions
*/
export const SearchResultListItemBlueprint = createExtensionBlueprint({
kind: 'search-result-list-item',
attachTo: {
@@ -23,10 +23,8 @@ import { createExtensionTester } from '@backstage/frontend-test-utils';
import { SearchResult } from '@backstage/plugin-search-common';
import { screen } from '@testing-library/react';
import React from 'react';
import {
BaseSearchResultListItemProps,
createSearchResultListItemExtension,
} from './alpha';
import { createSearchResultListItemExtension } from './extensions';
import { BaseSearchResultListItemProps } from './blueprints';
describe('createSearchResultListItemExtension', () => {
it('Should use the correct result component', async () => {
@@ -21,14 +21,12 @@ import {
createExtension,
createSchemaFromZod,
} from '@backstage/frontend-plugin-api';
import { SearchResultListItemExtension } from './extensions';
import {
SearchResultItemExtensionComponent,
SearchResultItemExtensionPredicate,
searchResultListItemDataRef,
} from './blueprints/types';
export * from './blueprints';
} from './blueprints';
import { SearchResultListItemExtension } from '../extensions';
import { searchResultListItemDataRef } from './blueprints/types';
/**
* @alpha
@@ -128,5 +126,8 @@ export function createSearchResultListItemExtension<
* @deprecated Use {@link SearchResultListItemBlueprint} instead
*/
export namespace createSearchResultListItemExtension {
/**
* @deprecated Use {@link SearchResultListItemBlueprint#dataRefs.item} instead
*/
export const itemDataRef = searchResultListItemDataRef;
}
+17
View File
@@ -0,0 +1,17 @@
/*
* Copyright 2024 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 './extensions';
export * from './blueprints';