Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-01-19 13:59:09 +01:00
parent 440c534dd8
commit 3a5eba9464
2 changed files with 37 additions and 15 deletions
+12 -4
View File
@@ -44,7 +44,7 @@ export function AboutCard({ variant }: AboutCardProps): JSX.Element;
// Warning: (ae-missing-release-tag) "AboutContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const AboutContent: ({ entity }: Props_2) => JSX.Element;
export const AboutContent: ({ entity }: Props) => JSX.Element;
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "AboutField" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -55,7 +55,7 @@ export const AboutField: ({
value,
gridSizes,
children,
}: Props_3) => JSX.Element;
}: Props_2) => JSX.Element;
// @public (undocumented)
export type BackstageOverrides = Overrides & {
@@ -444,11 +444,19 @@ export type PluginCatalogComponentsNameToClassKey = {
PluginCatalogSystemDiagramCard: SystemDiagramCardClassKey;
};
// Warning: (ae-forgotten-export) The symbol "RelatedEntitiesCard" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "RelatedEntitiesCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const RelatedEntitiesCard: RelatedEntitiesCard_2;
export const RelatedEntitiesCard: <T extends Entity>(props: {
variant?: 'gridItem' | undefined;
title: string;
columns: TableColumn<T>[];
entityKind?: string | undefined;
relationType: string;
emptyMessage: string;
emptyHelpLink: string;
asRenderableEntities: (entities: Entity[]) => T[];
}) => JSX.Element;
// Warning: (ae-missing-release-tag) "Router" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@@ -41,16 +41,30 @@ type Props<T extends Entity> = {
asRenderableEntities: (entities: Entity[]) => T[];
};
export function RelatedEntitiesCard<T extends Entity>({
variant = 'gridItem',
title,
columns,
entityKind,
relationType,
emptyMessage,
emptyHelpLink,
asRenderableEntities,
}: Props<T>) {
/**
* A low level card component that can be used as a building block for more
* specific cards.
*
* @remarks
*
* You probably want to make a dedicated component for your needs, which renders
* this card as its implementation with some of the props set to the appropriate
* values.
*
* @public
*/
export const RelatedEntitiesCard = <T extends Entity>(props: Props<T>) => {
const {
variant = 'gridItem',
title,
columns,
entityKind,
relationType,
emptyMessage,
emptyHelpLink,
asRenderableEntities,
} = props;
const { entity } = useEntity();
const { entities, loading, error } = useRelatedEntities(entity, {
type: relationType,
@@ -89,4 +103,4 @@ export function RelatedEntitiesCard<T extends Entity>({
entities={asRenderableEntities(entities || [])}
/>
);
}
};