Skip to content

Commit dea645a

Browse files
committed
cards grid width
if 2 cards, take the place
1 parent 63f06bb commit dea645a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

colab-webapp/src/main/node/app/src/components/cards/SubCardsGrid.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,19 @@ export default function SubCardsGrid({
145145
const [showMoreCards, setShowMoreCards] = React.useState<boolean>(false);
146146

147147
const effectiveNbCardByRow: number = React.useMemo(() => {
148+
const effectiveMaxRow = max((subCards || []).map(card => card.x)) || 0;
149+
150+
if (effectiveMaxRow < maxCardsInRow) {
151+
if (effectiveMaxRow === 1) {
152+
return 2;
153+
}
154+
return effectiveMaxRow;
155+
}
156+
148157
if (!showMoreCards) {
149158
return maxCardsInRow;
150159
}
151-
const effectiveMaxRow = max((subCards || []).map(card => card.x));
160+
152161
return max([effectiveMaxRow, maxCardsInRow]) || 0;
153162
}, [showMoreCards, subCards, maxCardsInRow]);
154163

@@ -300,7 +309,7 @@ export default function SubCardsGrid({
300309
lightIconButtonStyle,
301310
br_md,
302311
css({
303-
gridColumnStart: maxCardsInRow,
312+
gridColumnStart: effectiveNbCardByRow,
304313
gridRowStart: maxCardsInColumn,
305314
}),
306315
)}

0 commit comments

Comments
 (0)