-
Notifications
You must be signed in to change notification settings - Fork 3
/
thumbnails.js
91 lines (87 loc) · 2.45 KB
/
thumbnails.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import React from "react";
import { ChevronCompactDown, ChevronCompactUp } from "react-bootstrap-icons";
const Thumbnails = (props) => {
const {
photos,
fullscreen,
extend,
displayIndex,
changeDisplayIndex,
extendUpClassName,
extendThumbnailsDown,
extendThumbnailsUp,
} = props;
if (fullscreen === true) {
return (
<div className="fullscreen-thumbnails">
{photos.map((photo, i) => {
if (i === displayIndex && photo.thumbnail_url) {
return (
<img
src={photo.thumbnail_url}
id="photo-click"
className="fullscreen-selected-thumbnail"
/>
);
} else if (photo.thumbnail_url) {
return (
<img
src={photo.thumbnail_url}
className="fullscreen-nonselected-thumbnail"
onClick={() => changeDisplayIndex(i)}
id="photo-click"
/>
);
}
})}
</div>
);
} else {
return (
<div className="thumbnail-gallery-container">
<li>
<ChevronCompactUp
className={extendUpClassName}
onClick={extendThumbnailsUp}
/>
</li>
{photos.slice(extend, extend + 8).map((photo, i) => {
console.log(photo, i);
if (i < 7) {
if (displayIndex === i && photo.thumbnail_url) {
return (
<li key={i}>
<img
onClick={() => changeDisplayIndex(i + extend)}
className={"thumbnail-gallery-item selected"}
src={photo.thumbnail_url}
/>
</li>
);
} else if (displayIndex !== i && photo.thumbnail_url) {
return (
<li key={i}>
<img
onClick={() => changeDisplayIndex(i + extend)}
className={"thumbnail-gallery-item"}
src={photo.thumbnail_url}
/>
</li>
);
}
} else if (i === 7) {
return (
<li key={i}>
<ChevronCompactDown
className="down-chevron"
onClick={extendThumbnailsDown}
/>
</li>
);
}
})}
</div>
);
}
};
export default Thumbnails;