Skip to content

Commit 8ce4414

Browse files
committed
feat(index): shuffle carousel
1 parent 9c238a9 commit 8ce4414

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/ParticipantImages.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ const ImageList = [
5959
},
6060
];
6161

62+
function shuffleArray(arr) {
63+
arr.sort(() => Math.random() - 0.5);
64+
return arr;
65+
}
66+
6267
export default function ParticipantImages() {
6368
return (
6469
<section className={styles.imageCarousel}>
@@ -70,7 +75,7 @@ export default function ParticipantImages() {
7075
<div>
7176
<Carousel showArrows={true} ariaLabel='Images of participants'
7277
autoPlay={true} interval='6000' infiniteLoop={true}>
73-
{ImageList.map((props, idx) => (
78+
{shuffleArray(ImageList).map((props, idx) => (
7479
<div key={idx}>
7580
<img src={useBaseUrl(props.img)} />
7681
<p className={styles.imageCarouselCaption}>{props.title}</p>

0 commit comments

Comments
 (0)