The weeb for the next gen discord boat - Wamellow wamellow.com
bot discord
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

image-grid toFixedArrayLength

Luna b65d83dc 8d413629

+15 -3
+15 -3
components/image-grid.tsx
··· 13 13 14 14 export default function ImageGrid({ images }: Props) { 15 15 return ( 16 - <div className="w-full h-52 overflow-hidden rounded-xl"> 17 - <div className="grid grid-flow-col grid-rows-3 w-full md:gap-4 gap-3 rotate-6 relative right-8 bottom-10 md:bottom-20"> 18 - {[...images, ...images, ...images, ...images].map((image, i) => ( 16 + <div className="w-full h-52 overflow-hidden rounded-xl bg-wamellow shadow-xl"> 17 + <div className="grid grid-flow-col grid-rows-3 w-full md:gap-4 gap-3 rotate-3 relative right-8 bottom-10 md:bottom-20"> 18 + {toFixedArrayLength(images, 26).map((image, i) => ( 19 19 <Container 20 20 key={"imageGrid-" + image.id + i} 21 21 className="relative md:h-32 h-24 md:w-32 w-24 hover:scale-110 duration-200" ··· 76 76 </Link> 77 77 ); 78 78 79 + } 80 + 81 + function toFixedArrayLength<T>(arr: T[], length: number): T[] { 82 + const originalLength = arr.length; 83 + const numCopies = Math.ceil(length / originalLength); 84 + const slicedArray: T[] = []; 85 + 86 + for (let i = 0; i < numCopies; i++) { 87 + slicedArray.push(...arr); 88 + } 89 + 90 + return slicedArray.slice(0, length); 79 91 }