From 957ae8059b806d019a592c0600a860dc6b7c2d76 Mon Sep 17 00:00:00 2001 From: Mustansar Anwar ul Samad Date: Tue, 31 Aug 2021 16:47:18 +1200 Subject: [PATCH] Use themeId in TemplateCard from theme object The themeId should be picked up from the object to make sure that when a custom theme is provided, it's pageTheme list is used instead of one in the default theme package Signed-off-by: Mustansar Anwar ul Samad --- .changeset/lovely-guests-smell.md | 5 +++++ .../scaffolder/src/components/TemplateCard/TemplateCard.tsx | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .changeset/lovely-guests-smell.md diff --git a/.changeset/lovely-guests-smell.md b/.changeset/lovely-guests-smell.md new file mode 100644 index 0000000000..ef6bb8c8f4 --- /dev/null +++ b/.changeset/lovely-guests-smell.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder': patch +--- + +Use themeId in TemplateCard from theme object diff --git a/plugins/scaffolder/src/components/TemplateCard/TemplateCard.tsx b/plugins/scaffolder/src/components/TemplateCard/TemplateCard.tsx index 9d2e827be9..a02e6d3b14 100644 --- a/plugins/scaffolder/src/components/TemplateCard/TemplateCard.tsx +++ b/plugins/scaffolder/src/components/TemplateCard/TemplateCard.tsx @@ -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`, {