From 7ffc83d35e52e77b0ed3252e484bbf920a492e21 Mon Sep 17 00:00:00 2001 From: Satya Prakash Sasini Date: Sat, 9 Nov 2024 22:46:33 +0530 Subject: [PATCH] fix: arrow button visibility --- frontend/src/components/ui/ReviewCarousel.jsx | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/frontend/src/components/ui/ReviewCarousel.jsx b/frontend/src/components/ui/ReviewCarousel.jsx index 7031b5f..d0fb05e 100644 --- a/frontend/src/components/ui/ReviewCarousel.jsx +++ b/frontend/src/components/ui/ReviewCarousel.jsx @@ -153,25 +153,29 @@ const ReviewCarousel = () => { // whileHover is a framer specific attribute // It displaces buttons by 10px on hover for that nice slide animation } - - setActive((prev) => (prev + 1 < items.length ? prev + 1 : prev)) - } - whileHover={{ x: 10, color: '#00B2CA', opacity: 1 }} - > - {'>>'} - - setActive((prev) => (prev - 1 >= 0 ? prev - 1 : prev))} - whileHover={{ x: -10, color: '#00B2CA', opacity: 1 }} - > - {' '} - {'<<'} - + {active < items.length - 1 && ( + + setActive((prev) => (prev + 1 < items.length ? prev + 1 : prev)) + } + whileHover={{ x: 10, color: '#00B2CA', opacity: 1 }} + > + {'>>'} + + )} + {active > 0 && ( + setActive((prev) => (prev - 1 >= 0 ? prev - 1 : prev))} + whileHover={{ x: -10, color: '#00B2CA', opacity: 1 }} + > + {' '} + {'<<'} + + )} );