From a0a03da90dbdb0691add1493bb3748c3446b3b51 Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Thu, 24 Jul 2025 09:50:32 +0200 Subject: [PATCH] feat: reworking the layout again to support scrollable info cards Signed-off-by: benjdlambert --- .../src/alpha/DefaultEntityContentLayout.tsx | 78 +++++++++++-------- 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/plugins/catalog/src/alpha/DefaultEntityContentLayout.tsx b/plugins/catalog/src/alpha/DefaultEntityContentLayout.tsx index 21276f424a..ecae71f2e5 100644 --- a/plugins/catalog/src/alpha/DefaultEntityContentLayout.tsx +++ b/plugins/catalog/src/alpha/DefaultEntityContentLayout.tsx @@ -41,7 +41,7 @@ const useStyles = makeStyles< flexFlow: 'column nowrap', gap: theme.spacing(3), }, - contentArea: { + mainContent: { display: 'flex', flexFlow: 'column', gap: theme.spacing(3), @@ -51,9 +51,14 @@ const useStyles = makeStyles< infoArea: { display: 'flex', flexFlow: 'column nowrap', - alignItems: 'stretch', + alignItems: 'flex-start', gap: theme.spacing(3), minWidth: 0, + '& > *': { + flexShrink: 0, + flexGrow: 0, + flexBasis: 'auto', + }, }, summaryArea: { minWidth: 0, @@ -65,29 +70,32 @@ const useStyles = makeStyles< marginLeft: theme.spacing(3), }, }, + contentArea: { + display: 'flex', + flexFlow: 'column', + gap: theme.spacing(3), + alignItems: 'stretch', + minWidth: 0, + }, [theme.breakpoints.up('md')]: { root: { - display: 'grid', - gap: 0, - gridTemplateAreas: ({ summaryCards }) => ` - "${summaryCards ? 'summary' : 'content'} info" - "content info" - `, - gridTemplateColumns: ({ infoCards }) => (infoCards ? '2fr 1fr' : '1fr'), - alignItems: 'start', + display: 'flex', + flexDirection: 'row', + alignItems: 'flex-start', + gap: theme.spacing(3), + }, + mainContent: { + flex: '2 1 0', + minWidth: 0, }, infoArea: { - gridArea: 'info', + flex: '0 0 auto', + width: '33.333%', position: 'sticky', top: theme.spacing(3), - marginLeft: theme.spacing(3), - }, - contentArea: { - gridArea: 'content', - }, - summaryArea: { - gridArea: 'summary', - marginBottom: theme.spacing(3), + maxHeight: `calc(100vh - ${theme.spacing(6)}px)`, + overflowY: 'auto', + alignSelf: 'flex-start', }, }, })); @@ -139,23 +147,27 @@ export function DefaultEntityContentLayout(props: EntityContentLayoutProps) { <> {entityWarningContent}
+
+ {summaryCards.length > 0 ? ( +
+ + {summaryCards.map(card => ( +
{card.element}
+ ))} +
+
+ ) : null} + {contentCards.length > 0 ? ( +
+ {contentCards.map(card => card.element)} +
+ ) : null} +
{infoCards.length > 0 ? (
{infoCards.map(card => card.element)} -
- ) : null} - {summaryCards.length > 0 ? ( -
- - {summaryCards.map(card => ( -
{card.element}
- ))} -
-
- ) : null} - {contentCards.length > 0 ? ( -
- {contentCards.map(card => card.element)} + {infoCards.map(card => card.element)} + {infoCards.map(card => card.element)}
) : null}