File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,18 +199,19 @@ function PinnedPapersCarousel() {
199199 </ CarouselItem >
200200 ) : (
201201 chunkedPapers . map ( ( paperGroup , index ) => {
202- const placeholdersNeeded =
203- ( chunkSize - paperGroup . length ) % chunkSize ;
202+ const columns = chunkSize === 2 ? 1 : chunkSize === 4 ? 2 : 4 ;
203+ const rows = Math . max ( 1 , Math . ceil ( paperGroup . length / columns ) ) ;
204+ const placeholdersNeeded = columns * rows - paperGroup . length ;
204205 return (
205206 < CarouselItem
206207 key = { `carousel-item-${ index } ` }
207208 className = { `grid ${
208- chunkSize === 2
209- ? "grid-cols-1 grid-rows-2 "
210- : chunkSize === 4
211- ? "grid-cols-2 grid-rows-2 "
209+ columns === 1
210+ ? "grid-cols-1"
211+ : columns === 2
212+ ? "grid-cols-2"
212213 : "grid-cols-4"
213- } gap-4 lg:auto-rows-fr`}
214+ } ${ rows === 1 ? "grid-rows-1" : "grid-rows-2" } gap-4 lg:auto-rows-fr`}
214215 >
215216 { paperGroup . map ( ( paper , subIndex ) =>
216217 paper . subject === "add_subject_button" ? (
@@ -264,4 +265,4 @@ function PinnedPapersCarousel() {
264265 ) ;
265266}
266267
267- export default PinnedPapersCarousel ;
268+ export default PinnedPapersCarousel ;
You can’t perform that action at this time.
0 commit comments