@@ -44,6 +44,7 @@ var Gallery = function (_Component) {
4444
4545 _this . onResize = _this . onResize . bind ( _this ) ;
4646 _this . closeLightbox = _this . closeLightbox . bind ( _this ) ;
47+ _this . gotoImage = _this . gotoImage . bind ( _this ) ;
4748 _this . gotoNext = _this . gotoNext . bind ( _this ) ;
4849 _this . gotoPrevious = _this . gotoPrevious . bind ( _this ) ;
4950 _this . onClickImage = _this . onClickImage . bind ( _this ) ;
@@ -136,13 +137,27 @@ var Gallery = function (_Component) {
136137 event . preventDefault ( ) ;
137138 if ( this . props . onSelectImage ) this . props . onSelectImage ( index , this . state . images [ index ] ) ;
138139 }
140+ } , {
141+ key : 'gotoImage' ,
142+ value : function gotoImage ( index ) {
143+ this . setState ( {
144+ currentImage : index
145+ } ) ;
146+ }
139147 } , {
140148 key : 'getOnClickThumbnailFn' ,
141149 value : function getOnClickThumbnailFn ( ) {
142150 if ( ! this . props . onClickThumbnail && this . props . enableLightbox ) return this . openLightbox ;
143151 if ( this . props . onClickThumbnail ) return this . props . onClickThumbnail ;
144152 return null ;
145153 }
154+ } , {
155+ key : 'getOnClickLightboxThumbnailFn' ,
156+ value : function getOnClickLightboxThumbnailFn ( ) {
157+ if ( ! this . props . onClickLightboxThumbnail && this . props . showLightboxThumbnails ) return this . gotoImage ;
158+ if ( this . props . onClickLightboxThumbnail && this . props . showLightboxThumbnails ) return this . props . onClickLightboxThumbnail ;
159+ return null ;
160+ }
146161 } , {
147162 key : 'getOnClickImageFn' ,
148163 value : function getOnClickImageFn ( ) {
@@ -290,7 +305,9 @@ var Gallery = function (_Component) {
290305 showImageCount : this . props . showImageCount ,
291306 onClose : this . closeLightbox ,
292307 width : this . props . lightboxWidth ,
293- theme : this . props . theme
308+ theme : this . props . theme ,
309+ onClickThumbnail : this . getOnClickLightboxThumbnailFn ( ) ,
310+ showThumbnails : this . props . showLightboxThumbnails
294311 } )
295312 ) ;
296313 }
@@ -338,7 +355,9 @@ Gallery.propTypes = {
338355 showCloseButton : _propTypes2 . default . bool ,
339356 showImageCount : _propTypes2 . default . bool ,
340357 lightboxWidth : _propTypes2 . default . number ,
341- theme : _propTypes2 . default . object
358+ theme : _propTypes2 . default . object ,
359+ showLightboxThumbnails : _propTypes2 . default . bool ,
360+ onClickLightboxThumbnail : _propTypes2 . default . func
342361} ;
343362
344363Gallery . defaultProps = {
@@ -355,7 +374,8 @@ Gallery.defaultProps = {
355374 showCloseButton : true ,
356375 showImageCount : true ,
357376 lightboxWidth : 1024 ,
358- theme : { }
377+ theme : { } ,
378+ showLightboxThumbnails : false
359379} ;
360380
361381module . exports = Gallery ;
0 commit comments