mirror of
https://github.com/hexastack/hexabot
synced 2025-01-22 10:35:37 +00:00
fix: display carousel navigation buttons when we have more than one item
This commit is contained in:
parent
e0a8bc2b0c
commit
a7ab87cfa5
@ -81,6 +81,7 @@ const CarouselMessage: React.FC<CarouselMessageProps> = ({
|
||||
setActiveIndex((prevIndex) => (prevIndex + 1) % items.length);
|
||||
};
|
||||
const colors = allColors[messageCarousel.direction || "received"];
|
||||
const shouldDisplayNavigationButtons = items.length > 1;
|
||||
|
||||
return (
|
||||
<div
|
||||
@ -98,15 +99,19 @@ const CarouselMessage: React.FC<CarouselMessageProps> = ({
|
||||
<CarouselItem key={idx} message={message} idx={idx} />
|
||||
))}
|
||||
</div>
|
||||
<button
|
||||
className="sc-message--carousel-control prev"
|
||||
onClick={goToPrevious}
|
||||
>
|
||||
❮
|
||||
</button>
|
||||
<button className="sc-message--carousel-control next" onClick={goToNext}>
|
||||
❯
|
||||
</button>
|
||||
{shouldDisplayNavigationButtons && (
|
||||
<>
|
||||
<button
|
||||
className="sc-message--carousel-control prev"
|
||||
onClick={goToPrevious}
|
||||
>
|
||||
❮
|
||||
</button>
|
||||
<button className="sc-message--carousel-control next" onClick={goToNext}>
|
||||
❯
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user