Initial commit
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
21
src/lib/utils/picsum.ts
Normal file
21
src/lib/utils/picsum.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
const generatePhotos = (number: number, startId: number) => {
|
||||
const photos = [];
|
||||
|
||||
for (let i = 0; i < number; i++) {
|
||||
const id = startId + i;
|
||||
const width = 200 + Math.floor(Math.random() * 200);
|
||||
const height = 200 + Math.floor(Math.random() * 200);
|
||||
|
||||
photos.push({
|
||||
id,
|
||||
src: `https://picsum.photos/id/${id}/${width}/${height}`,
|
||||
alt: `Photo ${id}`,
|
||||
width,
|
||||
height,
|
||||
});
|
||||
}
|
||||
|
||||
return photos;
|
||||
};
|
||||
|
||||
export default generatePhotos;
|
Reference in New Issue
Block a user