Add lazy loading to all images

This commit is contained in:
Lim Chee Aun 2022-12-15 14:19:48 +08:00
parent 767b092ac6
commit 45b7d42d38

View file

@ -81,6 +81,7 @@ function Media({ media, showOriginal, onClick }) {
alt={description} alt={description}
width={width} width={width}
height={height} height={height}
loading="lazy"
style={ style={
!showOriginal && { !showOriginal && {
backgroundColor: backgroundColor:
@ -163,6 +164,7 @@ function Media({ media, showOriginal, onClick }) {
alt={description} alt={description}
width={width} width={width}
height={height} height={height}
loading="lazy"
/> />
)} )}
</div> </div>
@ -215,6 +217,7 @@ function Card({ card }) {
src={image} src={image}
width={width} width={width}
height={height} height={height}
loading="lazy"
alt="" alt=""
onError={() => { onError={() => {
this.style.display = 'none'; this.style.display = 'none';
@ -245,6 +248,7 @@ function Card({ card }) {
width={width} width={width}
height={height} height={height}
alt={title || description} alt={title || description}
loading="lazy"
style={{ style={{
height: 'auto', height: 'auto',
aspectRatio: `${width}/${height}`, aspectRatio: `${width}/${height}`,