From 646dab94ab0d65adce9a8f7716f23a472602d7c2 Mon Sep 17 00:00:00 2001 From: Sankalp Omprakash Pandey Date: Sat, 25 Oct 2025 13:50:45 +0530 Subject: [PATCH] fix: hide arrow buttons --- src/components/PapersCarousel.tsx | 113 +++++++++++++++--------------- 1 file changed, 58 insertions(+), 55 deletions(-) diff --git a/src/components/PapersCarousel.tsx b/src/components/PapersCarousel.tsx index 961c302..804f31f 100644 --- a/src/components/PapersCarousel.tsx +++ b/src/components/PapersCarousel.tsx @@ -63,66 +63,69 @@ function PapersCarousel() { const plugins = [Autoplay({ delay: 8000, stopOnInteraction: true })]; return ( -
-

- Upcoming Exams -

+
+

+ Upcoming Exams +

- -
- - -
- - - {isLoading ? ( - - - - ) : ( - chunkedPapers.map((paperGroup, index) => { - const placeholdersNeeded = chunkSize - paperGroup.length; + + {/* Only show arrows when there are multiple chunks to scroll through */} + {chunkedPapers.length > 1 && displayPapers.length > chunkSize && ( +
+ + +
+ )} - return ( + + {isLoading ? ( - {paperGroup.map((paper, subIndex) => ( -
- -
- ))} - - {Array.from({ length: placeholdersNeeded }).map( - (_, placeholderIndex) => ( -
- ), - )} +
- ); - }) - )} -
-
-
+ ) : ( + chunkedPapers.map((paperGroup, index) => { + const placeholdersNeeded = chunkSize - paperGroup.length; + + return ( + + {paperGroup.map((paper, subIndex) => ( +
+ +
+ ))} + + {Array.from({ length: placeholdersNeeded }).map( + (_, placeholderIndex) => ( +
+ ), + )} +
+ ); + }) + )} + + +
); } -export default PapersCarousel; +export default PapersCarousel; \ No newline at end of file