File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
colab-webapp/src/main/node/app/src/components/cards Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff 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 ) }
You can’t perform that action at this time.
0 commit comments