Skip to content

Commit 829c5d6

Browse files
Merge pull request #473 from SWITCHin2/fix/nav-carousel
fix: Arrow Buttons Visible at Carousel Start and End Positions
2 parents ca6cdb3 + 7ffc83d commit 829c5d6

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

frontend/src/components/ui/ReviewCarousel.jsx

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -153,25 +153,29 @@ const ReviewCarousel = () => {
153153
// whileHover is a framer specific attribute
154154
// It displaces buttons by 10px on hover for that nice slide animation
155155
}
156-
<motion.button
157-
id="next"
158-
className=" absolute top-[40%] text-green-900 bg-none border-none text-6xl font-mono font-bold opacity-80 transition-opacity z-10 right-[50px] max-sm:text-white max-sm:text-2xl max-sm:right-2"
159-
onClick={() =>
160-
setActive((prev) => (prev + 1 < items.length ? prev + 1 : prev))
161-
}
162-
whileHover={{ x: 10, color: '#00B2CA', opacity: 1 }}
163-
>
164-
{'>>'}
165-
</motion.button>
166-
<motion.button
167-
id="prev"
168-
className=" absolute top-[40%] text-green-900 bg-none border-none text-6xl font-mono font-bold opacity-80 transition-opacity z-10 left-[50px] max-sm:text-white max-sm:text-2xl max-sm:left-2"
169-
onClick={() => setActive((prev) => (prev - 1 >= 0 ? prev - 1 : prev))}
170-
whileHover={{ x: -10, color: '#00B2CA', opacity: 1 }}
171-
>
172-
{' '}
173-
{'<<'}
174-
</motion.button>
156+
{active < items.length - 1 && (
157+
<motion.button
158+
id="next"
159+
className=" absolute top-[40%] text-green-900 bg-none border-none text-6xl font-mono font-bold opacity-80 transition-opacity z-10 right-[50px] max-sm:text-white max-sm:text-2xl max-sm:right-2"
160+
onClick={() =>
161+
setActive((prev) => (prev + 1 < items.length ? prev + 1 : prev))
162+
}
163+
whileHover={{ x: 10, color: '#00B2CA', opacity: 1 }}
164+
>
165+
{'>>'}
166+
</motion.button>
167+
)}
168+
{active > 0 && (
169+
<motion.button
170+
id="prev"
171+
className=" absolute top-[40%] text-green-900 bg-none border-none text-6xl font-mono font-bold opacity-80 transition-opacity z-10 left-[50px] max-sm:text-white max-sm:text-2xl max-sm:left-2"
172+
onClick={() => setActive((prev) => (prev - 1 >= 0 ? prev - 1 : prev))}
173+
whileHover={{ x: -10, color: '#00B2CA', opacity: 1 }}
174+
>
175+
{' '}
176+
{'<<'}
177+
</motion.button>
178+
)}
175179
</div>
176180
</div>
177181
);

0 commit comments

Comments
 (0)