diff --git a/src/pages/MoreArt.jsx b/src/pages/MoreArt.jsx index e401bf1..bab68ce 100644 --- a/src/pages/MoreArt.jsx +++ b/src/pages/MoreArt.jsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { Card, @@ -35,6 +35,7 @@ import { const MoreArt = () => { const navigate = useNavigate(); const [savedStates, setSavedStates] = useState({}); + const [shuffledLists, setShuffledLists] = useState([]); const shareUrl = 'https://kyziq.github.io/artistry-hub/'; const title = 'Artistry-Hub'; const fixedWidth = '250px'; @@ -59,169 +60,169 @@ const MoreArt = () => { event.stopPropagation(); }; + // Function to shuffle the lists + const shuffleLists = (lists) => { + const shuffled = lists.map((list) => + [...list].sort(() => 0.5 - Math.random()) + ); + return [].concat(...shuffled); + }; + + useEffect(() => { + // Shuffle the images once when the component is mounted + setShuffledLists(shuffleLists(Object.values(allLists))); + }, []); + return (
-
- {Object.values(allLists).map((categoryList, categoryIndex) => ( -
- {categoryList.map((item, index) => ( - - handleImageClick(item.id)} - className="relative overflow-hidden inline-block group transition-opacity duration-300 hover:opacity-90" - style={{ - margin: '0 0 1.5em', - width: fixedWidth, - height: '100%', - }} +
+ {shuffledLists.map((item, index) => ( + + handleImageClick(item.id)} + className="relative overflow-hidden inline-block group transition-opacity duration-300 hover:opacity-90" + style={{ + margin: '0 0 1.5em', + width: fixedWidth, + height: '100%', + }} + > + + - - {item.name} - -
- - - - - + + {item.name} + +
+ + + + + + + - - - - Facebook - - - - - - - Whatsapp - - + + Facebook + + - - - - Twitter - - + + + + Whatsapp + + - - - - Reddit - - - - - - Email - - - - + + + + Twitter + + - - - - - + + + Reddit + + + + - handleDownload(item.img, item.name)} - startContent={ - - } - > - Download - - } - > - Report - - - -
-
- - - ))} -
+ + Email + + + + + + + + + + + handleDownload(item.img, item.name)} + startContent={ + + } + > + Download + + } + > + Report + + + +
+ +
+
))}