Use page theme fontColor consistently in scaffolder headers and cards.

This fixes problems with themes with white header background, which
end up with white-on-white text for card heads and context menus.

Signed-off-by: Axel Hecht <axel@pike.org>
This commit is contained in:
Axel Hecht
2023-03-06 14:14:41 +01:00
parent 479c7025f5
commit 3c96e77b51
5 changed files with 39 additions and 18 deletions
@@ -21,17 +21,22 @@ import { BackstageTheme } from '@backstage/theme';
import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';
import { FavoriteEntity } from '@backstage/plugin-catalog-react';
const useStyles = makeStyles<BackstageTheme, { cardBackgroundImage: string }>(
() => ({
header: {
backgroundImage: ({ cardBackgroundImage }) => cardBackgroundImage,
},
subtitleWrapper: {
display: 'flex',
justifyContent: 'space-between',
},
}),
);
const useStyles = makeStyles<
BackstageTheme,
{
cardFontColor: string;
cardBackgroundImage: string;
}
>(() => ({
header: {
backgroundImage: ({ cardBackgroundImage }) => cardBackgroundImage,
color: ({ cardFontColor }) => cardFontColor,
},
subtitleWrapper: {
display: 'flex',
justifyContent: 'space-between',
},
}));
/**
* Props for the CardHeader component
@@ -54,6 +59,7 @@ export const CardHeader = (props: CardHeaderProps) => {
const themeForType = getPageTheme({ themeId: type });
const styles = useStyles({
cardFontColor: themeForType.fontColor,
cardBackgroundImage: themeForType.backgroundImage,
});