Skip to content

Commit 6103f2b

Browse files
committed
Fix lint warnings
1 parent f397154 commit 6103f2b

File tree

1 file changed

+45
-44
lines changed

1 file changed

+45
-44
lines changed

src/lib/images/pig-grid.tsx

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,55 @@ function PigGrid({ items }: { items: Array<Photo> }) {
1010

1111
const { width } = useWindowSize();
1212

13-
const options = {
14-
containerId: 'pig',
15-
classPrefix: 'pig',
16-
spaceBetweenImages: 12,
17-
transitionSpeed: 500,
18-
primaryImageBufferHeight: 1000,
19-
secondaryImageBufferHeight: 300,
20-
urlForSize: function (filename: string, size: number) {
21-
return filename;
22-
},
23-
createElement: function (url: string) {
24-
// PhotoSwipe elements
25-
const item = items.find(item => item.url == url) as Photo;
26-
const anchor = document.createElement('a');
27-
anchor.href = url;
28-
anchor.setAttribute('data-pswp-width', item.width.toString());
29-
anchor.setAttribute('data-pswp-height', item.height.toString());
30-
anchor.target = '_blank';
31-
anchor.rel = 'noreferrer';
32-
const img = document.createElement('img');
33-
img.src = url;
34-
img.alt = '';
35-
return anchor;
36-
},
37-
getMinAspectRatio: function (lastWindowWidth: number) {
38-
if (lastWindowWidth <= 1920) {
39-
return 1;
40-
} else if (lastWindowWidth <= 2560) {
41-
return 1.5;
42-
} else {
43-
return 2;
44-
}
45-
},
46-
getImageSize: function (lastWindowWidth: number) {
47-
if (lastWindowWidth <= 1920) {
48-
return 400;
49-
} else if (lastWindowWidth <= 2560) {
50-
return 350;
51-
} else {
52-
return 300;
53-
}
54-
}
55-
};
56-
5713
useEffect(() => {
5814
const data = items.map(item => {
5915
return { filename: item.url, aspectRatio: item.width / item.height };
6016
});
17+
18+
const options = {
19+
containerId: 'pig',
20+
classPrefix: 'pig',
21+
spaceBetweenImages: 12,
22+
transitionSpeed: 500,
23+
primaryImageBufferHeight: 1000,
24+
secondaryImageBufferHeight: 300,
25+
urlForSize: function (filename: string, size: number) {
26+
return filename;
27+
},
28+
createElement: function (url: string) {
29+
// PhotoSwipe elements
30+
const item = items.find(item => item.url == url) as Photo;
31+
const anchor = document.createElement('a');
32+
anchor.href = url;
33+
anchor.setAttribute('data-pswp-width', item.width.toString());
34+
anchor.setAttribute('data-pswp-height', item.height.toString());
35+
anchor.target = '_blank';
36+
anchor.rel = 'noreferrer';
37+
const img = document.createElement('img');
38+
img.src = url;
39+
img.alt = '';
40+
return anchor;
41+
},
42+
getMinAspectRatio: function (lastWindowWidth: number) {
43+
if (lastWindowWidth <= 1920) {
44+
return 1;
45+
} else if (lastWindowWidth <= 2560) {
46+
return 1.5;
47+
} else {
48+
return 2;
49+
}
50+
},
51+
getImageSize: function (lastWindowWidth: number) {
52+
if (lastWindowWidth <= 1920) {
53+
return 400;
54+
} else if (lastWindowWidth <= 2560) {
55+
return 350;
56+
} else {
57+
return 300;
58+
}
59+
}
60+
};
61+
6162
const pigGrid = new window.Pig(data, options);
6263
pigGrid.enable();
6364

0 commit comments

Comments
 (0)