Merge pull request #7007 from msamad/msamad/use-custom-theme-id-for-template-card

Use themeId in TemplateCard from theme object
This commit is contained in:
Fredrik Adelöw
2021-08-31 19:01:59 +02:00
committed by GitHub
2 changed files with 9 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder': patch
---
Use themeId in TemplateCard from theme object
@@ -27,7 +27,7 @@ import {
getEntityRelations,
getEntitySourceLocation,
} from '@backstage/plugin-catalog-react';
import { BackstageTheme, pageTheme } from '@backstage/theme';
import { BackstageTheme } from '@backstage/theme';
import {
Box,
Card,
@@ -149,7 +149,9 @@ export const TemplateCard = ({ template, deprecated }: TemplateCardProps) => {
template as Entity,
RELATION_OWNED_BY,
);
const themeId = pageTheme[templateProps.type] ? templateProps.type : 'other';
const themeId = backstageTheme.getPageTheme({ themeId: templateProps.type })
? templateProps.type
: 'other';
const theme = backstageTheme.getPageTheme({ themeId });
const classes = useStyles({ backgroundImage: theme.backgroundImage });
const href = generatePath(`${rootLink()}/templates/:templateName`, {