italia / cloud.italia.it-site

Sorgente del sito cloud.italia.it
https://cloud.italia.it
BSD 3-Clause "New" or "Revised" License
10 stars 11 forks source link

Always use gatsby-image when possible #152

Open bfabio opened 2 years ago

bfabio commented 2 years ago

We should always use gatsby-image for images when possible (ie. use <Img> objects).

fe. Images at https://cloud.italia.it/notizie/ don't use gatsby-image, we should fix that.

dptdgi commented 1 month ago

@bfabio still relevant? Please point out wrong and suggested usage!

bfabio commented 1 month ago

@dptdgi yes

Take a look at the home page, the images are loaded only when they are about to enter the viewport:

https://github.com/italia/cloud.italia.it-site/assets/788293/11201662-ff86-4ef2-aa07-8a99e00bb132

Whereas https://cloud.italia.it/notizie/ loads all the images as soon as you go there:

https://github.com/italia/cloud.italia.it-site/assets/788293/8dc291d1-05bf-4486-95f2-a992310b12a9

In general, if the image:

they are not using gatsby-image.

dptdgi commented 1 month ago

Thanks @bfabio, I was thinking about pointing out the issue in the code. Thanks for the effort in showing the problem in the UI. I guess the tag < img > is used instead of < StaticImage >