From 7388c6516d725f5d21c1b288298ce0b618720dd8 Mon Sep 17 00:00:00 2001 From: Johan Persson Date: Mon, 2 Mar 2026 16:40:47 +0100 Subject: [PATCH] refactor(catalog): use Grid.Item colSpan for full-width AboutFields Replace inline `style={{ gridColumn: '1 / -1' }}` with BUI-native `Grid.Item colSpan` for full-width fields in AboutContent. Extract grid columns into a shared variable used by both Grid.Root and Grid.Item to keep them in sync. Remove the `style` prop from AboutField that was only added to support the inline gridColumn approach. Signed-off-by: Johan Persson --- .../src/components/AboutCard/AboutContent.tsx | 64 ++++++++++--------- .../src/components/AboutCard/AboutField.tsx | 14 +--- 2 files changed, 36 insertions(+), 42 deletions(-) diff --git a/plugins/catalog/src/components/AboutCard/AboutContent.tsx b/plugins/catalog/src/components/AboutCard/AboutContent.tsx index d35891cd05..503d963575 100644 --- a/plugins/catalog/src/components/AboutCard/AboutContent.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutContent.tsx @@ -114,20 +114,21 @@ export function AboutContent(props: AboutContentProps) { entitySourceLocation = undefined; } + const columns = { initial: '1', sm: '2', lg: '3' } as const; + return ( - - - - + + + + + + {isLocation && (entity?.spec?.targets || entity?.spec?.target) && ( - - target as string) - .map(target => ({ - text: target, - href: getLocationTargetHref( - target, - (entity?.spec?.type || t('aboutCard.unknown')) as string, - entitySourceLocation!, - ), - }))} - /> - + + + target as string) + .map(target => ({ + text: target, + href: getLocationTargetHref( + target, + (entity?.spec?.type || t('aboutCard.unknown')) as string, + entitySourceLocation!, + ), + }))} + /> + + )} ); diff --git a/plugins/catalog/src/components/AboutCard/AboutField.tsx b/plugins/catalog/src/components/AboutCard/AboutField.tsx index 87f817c643..36a0406876 100644 --- a/plugins/catalog/src/components/AboutCard/AboutField.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutField.tsx @@ -17,7 +17,7 @@ import { useElementFilter } from '@backstage/core-plugin-api'; import Typography from '@material-ui/core/Typography'; import { makeStyles } from '@material-ui/core/styles'; -import { CSSProperties, ReactNode } from 'react'; +import { ReactNode } from 'react'; import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; import { catalogTranslationRef } from '../../alpha/translation'; @@ -50,19 +50,11 @@ export interface AboutFieldProps { gridSizes?: Record; children?: ReactNode; className?: string; - style?: CSSProperties; } /** @public */ export function AboutField(props: AboutFieldProps) { - const { - label, - value, - gridSizes: _gridSizes, - children, - className, - style, - } = props; + const { label, value, gridSizes: _gridSizes, children, className } = props; const classes = useStyles(); const { t } = useTranslationRef(catalogTranslationRef); @@ -78,7 +70,7 @@ export function AboutField(props: AboutFieldProps) { ); return ( -
+
{label}