This commit is contained in:
Infinite
2020-01-20 21:56:23 +01:00
parent 9827647122
commit 244c8ff234
82 changed files with 3729 additions and 2304 deletions

View File

@@ -11,7 +11,10 @@ export const GalleryViewer: FunctionComponent<IProps> = ({ gallery }) => {
const [currentImage, setCurrentImage] = useState<number>(0);
const [lightboxIsOpen, setLightboxIsOpen] = useState<boolean>(false);
function openLightbox(_event: React.MouseEvent<Element>, obj: {index: number}) {
function openLightbox(
_event: React.MouseEvent<Element>,
obj: { index: number }
) {
setCurrentImage(obj.index);
setLightboxIsOpen(true);
}
@@ -26,8 +29,15 @@ export const GalleryViewer: FunctionComponent<IProps> = ({ gallery }) => {
setCurrentImage(currentImage + 1);
}
const photos = gallery.files.map((file) => ({src: file.path || "", caption: file.name}));
const thumbs = gallery.files.map((file) => ({src: `${file.path}?thumb=true` || "", width: 1, height: 1}));
const photos = gallery.files.map(file => ({
src: file.path || "",
caption: file.name
}));
const thumbs = gallery.files.map(file => ({
src: `${file.path}?thumb=true` || "",
width: 1,
height: 1
}));
return (
<div>
<Gallery photos={thumbs} columns={15} onClick={openLightbox} />