Fix lazy loading (Firefox)

see https://bugzilla.mozilla.org/show_bug.cgi?id=1647077

`loading` attribute needs to be before `src` attribute
This commit is contained in:
Stefan Forstenlechner 2024-08-21 22:54:32 +02:00
parent 18661afbc9
commit 4da3376d5f
2 changed files with 2 additions and 2 deletions

View File

@ -13,9 +13,9 @@ export interface PhotoWithFolder extends ImageWithThumbnail {
const PreviewFolder = ({ folder }: { folder: FolderPreview }) => { const PreviewFolder = ({ folder }: { folder: FolderPreview }) => {
return ( return (
<img <img
loading="lazy"
src={folder.imagePreview.thumbnail} src={folder.imagePreview.thumbnail}
alt={folder.name} alt={folder.name}
loading="lazy"
style={{ style={{
objectFit: "cover", objectFit: "cover",
width: "100%", width: "100%",

View File

@ -22,7 +22,7 @@ export const ImageGallery = ({ images }: { images: ImageWithThumbnail[] }) => {
photos={images} photos={images}
render={{ render={{
image: (props, context) => ( image: (props, context) => (
<img {...props} src={context.photo.thumbnail} loading={"lazy"} /> <img loading={"lazy"} {...props} src={context.photo.thumbnail} />
), ),
}} }}
onClick={({ index }) => setIndex(index)} onClick={({ index }) => setIndex(index)}