import React, { useState, useEffect } from 'react'; import Box from '@material-ui/core/Box'; import { makeStyles } from '@material-ui/core/styles'; const useStyles = makeStyles(theme => ({ background: { width: "100%", height: "100%", overflow: "auto", position: "absolute", "background-color": "rgba(0,0,0,1)", 'overflow': 'hidden', }, image_container: { 'width': '100%', 'height': '100%', 'overflow': 'hidden', }, image: { 'object-fit': 'contain', 'width': '100%', 'height': '100%', 'overflow': 'hidden', }, })); export function GalleryImageRender(props) { const { src } = props; const classes = useStyles(); return ( ); } export function GalleryPhoto(props) { const { photo } = props; // First show the fast (thumbnail) image. const [src, setSrc] = useState(photo.state.thumbnailpath); // Start a fetch of the full image, then show that. useEffect(() => { console.log("Fetching..."); fetch(photo.state.path) .then(() => { console.log("Fetch done. setting image."); setSrc(photo.state.path); }) }, []); return ( ); } export function GalleryVideo(props) { const { video } = props; const classes = useStyles(); return ( <> ); } export function GalleryItem(props) { const { item } = props; if (item.state.is_video) { return ; } else { return ; } } export function Gallery(props) { const { onClose, items, current_item } = props; const classes = useStyles(); var maybe_photo = false; if (items && items.length > 0 && current_item < items.length) { maybe_photo = items[current_item]; } return ( <> { maybe_photo && } ); }