Skip to content

Commit 1f95653

Browse files
author
ben
committed
v0.3.6
1 parent e099176 commit 1f95653

File tree

4 files changed

+40
-12
lines changed

4 files changed

+40
-12
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# react-grid-gallery
22

3+
### v0.3.6 / 2017-06-07
4+
5+
* Added optional lightbox prop `showLightboxThumbnails` to display thumbnails beneath the Lightbox image.
6+
7+
* Added optional lightbox prop `onClickLightboxThumbnail` as a fn to execute when lightbox thumbnail clicked. Overrides internal function: gotoImage.
8+
9+
310
### v0.3.5 / 2017-06-04
411

512
* Refactored for react 16 (moved from PropTypes to prop-types package).

lib/Gallery.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

344363
Gallery.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

361381
module.exports = Gallery;

lib/react-grid-gallery.bundle.min.js

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-grid-gallery",
3-
"version": "0.3.5",
3+
"version": "0.3.6",
44
"description": "Justified gallery component for React.",
55
"main": "lib/Gallery.js",
66
"dependencies": {

0 commit comments

Comments
 (0)