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:
+6
-1
@@ -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: {
|
||||
+2
-4
@@ -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;
|
||||
}
|
||||
@@ -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';
|
||||
Reference in New Issue
Block a user