1
0
Fork 0

wip(org): Added blog index page

This commit is contained in:
Joost De Cock 2022-05-29 18:44:32 +02:00
parent a23723c6b6
commit 8b7ea76325
2 changed files with 69 additions and 29 deletions

View file

@ -76,3 +76,21 @@ export const optionType = option => {
export const capitalize = string => string.charAt(0).toUpperCase() + string.slice(1);
export const strapiImage = (img, sizes=['thumbnail', 'xlarge', 'large', 'medium', 'small', 'xsmall']) => {
const image = {
caption: img.caption,
w: img.width,
h: img.height,
url: img.url,
sizes: {}
}
for (const size of sizes) {
if (img.formats[size]) image.sizes[size] = {
w: img.formats[size].width,
h: img.formats[size].width,
url: img.formats[size].url,
}
}
return image
}