Use a more strict type for variant of cards

Signed-off-by: Oliver Sand <oliver.sand@sda-se.com>
This commit is contained in:
Oliver Sand
2021-02-17 11:41:39 +01:00
parent 2d8e78ed4c
commit f4c2bcf54b
15 changed files with 74 additions and 44 deletions
@@ -20,10 +20,10 @@ import {
RELATION_CHILD_OF,
RELATION_PARENT_OF,
} from '@backstage/catalog-model';
import { Avatar, InfoCard } from '@backstage/core';
import { Avatar, InfoCard, InfoCardVariants } from '@backstage/core';
import {
getEntityRelations,
entityRouteParams,
getEntityRelations,
useEntity,
} from '@backstage/plugin-catalog-react';
import {
@@ -81,7 +81,7 @@ export const GroupProfileCard = ({
}: {
/** @deprecated The entity is now grabbed from context instead */
entity?: GroupEntity;
variant: string;
variant?: InfoCardVariants;
}) => {
const group = useEntity().entity as GroupEntity;
const {
@@ -15,7 +15,7 @@
*/
import { Entity } from '@backstage/catalog-model';
import { InfoCard, Progress, useApi } from '@backstage/core';
import { InfoCard, InfoCardVariants, Progress, useApi } from '@backstage/core';
import {
catalogApiRef,
isOwnerOf,
@@ -121,7 +121,7 @@ export const OwnershipCard = ({
}: {
/** @deprecated The entity is now grabbed from context instead */
entity?: Entity;
variant: string;
variant?: InfoCardVariants;
}) => {
const { entity } = useEntity();
const catalogApi = useApi(catalogApiRef);
@@ -18,7 +18,7 @@ import {
RELATION_MEMBER_OF,
UserEntity,
} from '@backstage/catalog-model';
import { Avatar, InfoCard } from '@backstage/core';
import { Avatar, InfoCard, InfoCardVariants } from '@backstage/core';
import { entityRouteParams, useEntity } from '@backstage/plugin-catalog-react';
import {
Box,
@@ -73,7 +73,7 @@ export const UserProfileCard = ({
}: {
/** @deprecated The entity is now grabbed from context instead */
entity?: UserEntity;
variant: string;
variant?: InfoCardVariants;
}) => {
const user = useEntity().entity as UserEntity;
const {