fix: OwnershipCard could be unscrollable when using together with react-grid-layout

Signed-off-by: JounQin <admin@1stg.me>
This commit is contained in:
JounQin
2024-03-01 15:04:43 +08:00
parent 80bcb8a84d
commit a767aaa472
4 changed files with 33 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-org': patch
---
fix: `OwnershipCard` could be unscrollable when using together with `react-grid-layout`
@@ -107,11 +107,13 @@ const EntityCountTile = ({
};
export const ComponentsGrid = ({
className,
entity,
relationsType,
entityFilterKind,
entityLimit = 6,
}: {
className?: string;
entity: Entity;
relationsType: EntityRelationAggregation;
entityFilterKind?: string[];
@@ -132,7 +134,7 @@ export const ComponentsGrid = ({
}
return (
<Grid container>
<Grid container className={className}>
{componentsWithCounters?.map(c => (
<Grid item xs={6} md={6} lg={4} key={c.type ?? c.kind}>
<EntityCountTile
@@ -98,7 +98,12 @@ export const Default = () =>
<ApiProvider apis={apis}>
<EntityProvider entity={defaultEntity}>
<Grid container spacing={4}>
<Grid item xs={12} md={6}>
<Grid
item
xs={12}
md={6}
style={{ maxHeight: 320, overflow: 'hidden' }}
>
<OwnershipCard />
</Grid>
</Grid>
@@ -30,6 +30,14 @@ import { ComponentsGrid } from './ComponentsGrid';
import { EntityRelationAggregation } from './types';
const useStyles = makeStyles(theme => ({
card: {
maxHeight: '100%',
},
cardContent: {
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
},
list: {
[theme.breakpoints.down('xs')]: {
padding: `0 0 12px`,
@@ -50,6 +58,10 @@ const useStyles = makeStyles(theme => ({
transform: 'unset',
},
},
grid: {
overflowY: 'auto',
marginTop: 0,
},
}));
/** @public */
@@ -84,7 +96,12 @@ export const OwnershipCard = (props: {
}, [setRelationsType, defaultRelationsType, relationsType]);
return (
<InfoCard title="Ownership" variant={variant}>
<InfoCard
title="Ownership"
variant={variant}
className={classes.card}
cardClassName={classes.cardContent}
>
{!relationsToggle && (
<List dense>
<ListItem className={classes.list}>
@@ -118,6 +135,7 @@ export const OwnershipCard = (props: {
</List>
)}
<ComponentsGrid
className={classes.grid}
entity={entity}
entityLimit={entityLimit}
relationsType={getRelationsType}