diff --git a/src/components/galleryPage/galleryPage.jsx b/src/components/galleryPage/galleryPage.jsx index 5c1e195..9b423fe 100644 --- a/src/components/galleryPage/galleryPage.jsx +++ b/src/components/galleryPage/galleryPage.jsx @@ -14,7 +14,19 @@ class GalleryPage extends Component{ let photoUrl = urlConstructor.getPhotoUrl(item.farm, item.server, item.id, item.secret, 'b'); return( - + { + this.props.photoClickHandler({ + photoSrc : photoUrl, + title : item.title, + owner : item.ownername + }); + }} + /> ); }); } @@ -25,7 +37,20 @@ class GalleryPage extends Component{ let smallUrl = urlConstructor.getPhotoUrl(item.farm, item.server, item.id, item.secret, 's'); return( - + { + this.props.photoClickHandler({ + photoSrc : photoUrl, + title : item.title, + owner : item.ownername + }); + }} + /> ); }); }; diff --git a/src/routes/galleryPage/GalleryPageContainer.jsx b/src/routes/galleryPage/GalleryPageContainer.jsx index 85e2388..68e1000 100644 --- a/src/routes/galleryPage/GalleryPageContainer.jsx +++ b/src/routes/galleryPage/GalleryPageContainer.jsx @@ -4,6 +4,10 @@ import { connect } from 'react-redux'; import galleryPageActions from '../../actions/galleryPageActions/galleryPageActions'; import GalleryPage from '../../components/galleryPage/galleryPage.jsx'; + +import Modal from '../../components/common/modal.jsx'; + + import '../../styles/galleryPage/galleryPage.scss'; @@ -20,6 +24,8 @@ class GalleryPageContainer extends Component{ this.state ={ callNetworkFlag : true, + showModal : false, + modalPhoto : {} } } @@ -39,7 +45,7 @@ class GalleryPageContainer extends Component{ toast.info(`🚀 Fetching Page #${currentPage + 1}`, { - position: "bottom-center", + position: "bottom-right", autoClose: 5000, hideProgressBar: false, closeOnClick: true, @@ -50,10 +56,44 @@ class GalleryPageContainer extends Component{ } }; + openModal = photoDetails =>{ + this.setState({ + showModal : true, + modalPhoto : photoDetails + }); + }; + + photoClickHandler = photoDetails =>{ + console.log('photo clicked'); + this.openModal(photoDetails); + }; + + closeModal = () =>{ + this.setState({ + showModal : false, + modalPhoto : {} + }); + }; + render(){ const { photos, currentPage, isFetching, totalPageCount} = this.props.galleryPage; return(