Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-photo-gallery

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-photo-gallery - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

examples/src/.app.js.swo

255

examples/dist/bundle.js
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"react-photo-gallery":[function(require,module,exports){
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _react = require('react');

@@ -18,116 +30,148 @@

var Gallery = _react2['default'].createClass({
displayName: 'Gallery',
propTypes: {
photos: _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.shape({
src: _react2['default'].PropTypes.string.isRequired,
width: _react2['default'].PropTypes.number.isRequired,
height: _react2['default'].PropTypes.number.isRequired,
aspectRatio: _react2['default'].PropTypes.number.isRequired,
lightboxImage: _react2['default'].PropTypes.object.isRequired
})).isRequired
},
getInitialState: function getInitialState() {
return {
var Gallery = (function (_React$Component) {
_inherits(Gallery, _React$Component);
function Gallery() {
_classCallCheck(this, Gallery);
_get(Object.getPrototypeOf(Gallery.prototype), 'constructor', this).call(this);
this.state = {
currentImage: 0,
containerWidth: 0
};
},
componentDidMount: function componentDidMount() {
this.setState({ containerWidth: Math.floor(_reactDom2['default'].findDOMNode(this).clientWidth) });
window.addEventListener('resize', this.handleResize);
},
componentDidUpdate: function componentDidUpdate() {
if (_reactDom2['default'].findDOMNode(this).clientWidth !== this.state.containerWidth) {
this.handleResize = this.handleResize.bind(this);
this.closeLightbox = this.closeLightbox.bind(this);
this.gotoNext = this.gotoNext.bind(this);
this.gotoPrevious = this.gotoPrevious.bind(this);
this.openLightbox = this.openLightbox.bind(this);
}
_createClass(Gallery, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.setState({ containerWidth: Math.floor(_reactDom2['default'].findDOMNode(this).clientWidth) });
window.addEventListener('resize', this.handleResize);
}
},
handleResize: function handleResize(e) {
this.setState({ containerWidth: Math.floor(_reactDom2['default'].findDOMNode(this).clientWidth) });
},
openLightbox: function openLightbox(index, event) {
event.preventDefault();
this.setState({
currentImage: index,
lightboxIsOpen: true
});
},
closeLightbox: function closeLightbox() {
this.setState({
currentImage: 0,
lightboxIsOpen: false
});
},
gotoPrevious: function gotoPrevious() {
this.setState({
currentImage: this.state.currentImage - 1
});
},
gotoNext: function gotoNext() {
this.setState({
currentImage: this.state.currentImage + 1
});
},
render: function render() {
var rowLimit = 1,
photoPreviewNodes = [];
if (this.state.containerWidth >= 480) {
rowLimit = 2;
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
if (_reactDom2['default'].findDOMNode(this).clientWidth !== this.state.containerWidth) {
this.setState({ containerWidth: Math.floor(_reactDom2['default'].findDOMNode(this).clientWidth) });
}
}
if (this.state.containerWidth >= 1024) {
rowLimit = 3;
}, {
key: 'handleResize',
value: function handleResize(e) {
this.setState({ containerWidth: Math.floor(_reactDom2['default'].findDOMNode(this).clientWidth) });
}
var contWidth = this.state.containerWidth - rowLimit * 4; /* 4px for margin around each image*/
contWidth = Math.floor(contWidth - 2); // add some padding to prevent layout prob
var lightboxImages = [];
for (var i = 0; i < this.props.photos.length; i += rowLimit) {
var rowItems = [];
// loop thru each set of rowLimit num
// eg. if rowLimit is 3 it will loop thru 0,1,2, then 3,4,5 to perform calculations for the particular set
var aspectRatio = 0,
totalAr = 0,
commonHeight = 0;
for (var j = i; j < i + rowLimit; j++) {
if (j == this.props.photos.length) {
break;
}
totalAr += this.props.photos[j].aspectRatio;
}, {
key: 'openLightbox',
value: function openLightbox(index, event) {
event.preventDefault();
this.setState({
currentImage: index,
lightboxIsOpen: true
});
}
}, {
key: 'closeLightbox',
value: function closeLightbox() {
this.setState({
currentImage: 0,
lightboxIsOpen: false
});
}
}, {
key: 'gotoPrevious',
value: function gotoPrevious() {
this.setState({
currentImage: this.state.currentImage - 1
});
}
}, {
key: 'gotoNext',
value: function gotoNext() {
this.setState({
currentImage: this.state.currentImage + 1
});
}
}, {
key: 'render',
value: function render() {
var rowLimit = 1,
photoPreviewNodes = [];
if (this.state.containerWidth >= 480) {
rowLimit = 2;
}
commonHeight = contWidth / totalAr;
// run thru the same set of items again to give the common height
for (var k = i; k < i + rowLimit; k++) {
if (k == this.props.photos.length) {
break;
if (this.state.containerWidth >= 1024) {
rowLimit = 3;
}
var contWidth = this.state.containerWidth - rowLimit * 4; /* 4px for margin around each image*/
contWidth = Math.floor(contWidth - 2); // add some padding to prevent layout prob
var lightboxImages = [];
for (var i = 0; i < this.props.photos.length; i += rowLimit) {
var rowItems = [];
// loop thru each set of rowLimit num
// eg. if rowLimit is 3 it will loop thru 0,1,2, then 3,4,5 to perform calculations for the particular set
var aspectRatio = 0,
totalAr = 0,
commonHeight = 0;
for (var j = i; j < i + rowLimit; j++) {
if (j == this.props.photos.length) {
break;
}
totalAr += this.props.photos[j].aspectRatio;
}
lightboxImages.push(this.props.photos[k].lightboxImage);
var src = this.props.photos[k].src;
photoPreviewNodes.push(_react2['default'].createElement(
'div',
{ key: k, style: style },
_react2['default'].createElement(
'a',
{ href: '#', className: k, onClick: this.openLightbox.bind(this, k) },
_react2['default'].createElement('img', { src: src, style: { display: 'block', border: 0 }, height: commonHeight, width: commonHeight * this.props.photos[k].aspectRatio, alt: '' })
)
));
commonHeight = contWidth / totalAr;
// run thru the same set of items again to give the common height
for (var k = i; k < i + rowLimit; k++) {
if (k == this.props.photos.length) {
break;
}
lightboxImages.push(this.props.photos[k].lightboxImage);
var src = this.props.photos[k].src;
photoPreviewNodes.push(_react2['default'].createElement(
'div',
{ key: k, style: style },
_react2['default'].createElement(
'a',
{ href: '#', className: k, onClick: this.openLightbox.bind(this, k) },
_react2['default'].createElement('img', { src: src, style: { display: 'block', border: 0 }, height: commonHeight, width: commonHeight * this.props.photos[k].aspectRatio, alt: '' })
)
));
}
}
return _react2['default'].createElement(
'div',
{ id: 'Gallery', className: 'clearfix' },
photoPreviewNodes,
_react2['default'].createElement(_reactImages2['default'], {
currentImage: this.state.currentImage,
images: lightboxImages,
isOpen: this.state.lightboxIsOpen,
onClose: this.closeLightbox,
onClickPrev: this.gotoPrevious,
onClickNext: this.gotoNext,
width: 1600,
height: 1600,
styles: this.props.lightboxStyles
})
);
}
return _react2['default'].createElement(
'div',
{ id: 'Gallery', className: 'clearfix' },
photoPreviewNodes,
_react2['default'].createElement(_reactImages2['default'], {
currentImage: this.state.currentImage,
images: lightboxImages,
isOpen: this.state.lightboxIsOpen,
onClose: this.closeLightbox,
onClickPrev: this.gotoPrevious,
onClickNext: this.gotoNext,
width: 1600,
height: 1600,
styles: this.props.lightboxStyles
})
);
}
});
}]);
return Gallery;
})(_react2['default'].Component);
;
Gallery.displayName = 'Gallery';
Gallery.propTypes = {
photos: _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.shape({
src: _react2['default'].PropTypes.string.isRequired,
width: _react2['default'].PropTypes.number.isRequired,
height: _react2['default'].PropTypes.number.isRequired,
aspectRatio: _react2['default'].PropTypes.number.isRequired,
lightboxImage: _react2['default'].PropTypes.object.isRequired
})).isRequired
};
// Gallery image style

@@ -141,5 +185,6 @@ var style = {

module.exports = Gallery;
exports['default'] = Gallery;
module.exports = exports['default'];
},{"react":undefined,"react-dom":undefined,"react-images":undefined}]},{},[])
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9yZWFjdC1jb21wb25lbnQtZ3VscC10YXNrcy9ub2RlX21vZHVsZXMvYnJvd3NlcmlmeS9ub2RlX21vZHVsZXMvYnJvd3Nlci1wYWNrL19wcmVsdWRlLmpzIiwiL1VzZXJzL2hlbGVuaWEvcmVhY3QtcGhvdG8tZ2FsbGVyeS9zcmMvR2FsbGVyeS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7cUJDQWtCLE9BQU87Ozs7d0JBQ0osV0FBVzs7OzsyQkFDWCxjQUFjOzs7O0FBRW5DLElBQUksT0FBTyxHQUFHLG1CQUFNLFdBQVcsQ0FBQztBQUM1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SGVpZ2h0ID0gY29udFdpZHRoIC8gdG90YWxBcjtcbiAgICAgICAgICAgIC8vIHJ1biB0aHJ1IHRoZSBzYW1lIHNldCBvZiBpdGVtcyBhZ2FpbiB0byBnaXZlIHRoZSBjb21tb24gaGVpZ2h0XG4gICAgICAgICAgICBmb3IgKHZhciBrPWk7IGs8aStyb3dMaW1pdDsgaysrKXtcbiAgICAgICAgICAgICAgICBpZiAoayA9PSB0aGlzLnByb3BzLnBob3Rvcy5sZW5ndGgpe1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cdFx0bGlnaHRib3hJbWFnZXMucHVzaCh0aGlzLnByb3BzLnBob3Rvc1trXS5saWdodGJveEltYWdlKTtcblx0XHR2YXIgc3JjID0gdGhpcy5wcm9wcy5waG90b3Nba10uc3JjO1xuICAgICAgICAgICAgICAgIHBob3RvUHJldmlld05vZGVzLnB1c2goXG4gICAgICAgICAgICAgICAgICAgICA8ZGl2IGtleT17a30gc3R5bGU9e3N0eWxlfT5cbiAgICAgICAgICAgICAgICAgICAgICAgIDxhIGhyZWY9XCIjXCIgY2xhc3NOYW1lPXtrfSBvbkNsaWNrPXt0aGlzLm9wZW5MaWdodGJveC5iaW5kKHRoaXMsIGspfT48aW1nIHNyYz17c3JjfSBzdHlsZT17e2Rpc3BsYXk6J2Jsb2NrJywgYm9yZGVyOjB9fSBoZWlnaHQ9e2NvbW1vbkhlaWdodH0gd2lkdGg9e2NvbW1vbkhlaWdodCAqIHRoaXMucHJvcHMucGhvdG9zW2tdLmFzcGVjdFJhdGlvfSBhbHQ9XCJcIiAvPjwvYT5cbiAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblx0cmV0dXJuKFxuICAgICAgICAgICAgPGRpdiBpZD1cIkdhbGxlcnlcIiBjbGFzc05hbWU9XCJjbGVhcmZpeFwiPlxuICAgICAgICAgICAgICAgIHtwaG90b1ByZXZpZXdOb2Rlc31cbiAgICAgICAgICAgICAgICA8TGlnaHRib3hcblx0XHQgICAgY3VycmVudEltYWdlPXt0aGlzLnN0YXRlLmN1cnJlbnRJbWFnZX1cbiAgICAgICAgICAgICAgICAgICAgaW1hZ2VzPXtsaWdodGJveEltYWdlc31cbiAgICAgICAgICAgICAgICAgICAgaXNPcGVuPXt0aGlzLnN0YXRlLmxpZ2h0Ym94SXNPcGVufVxuICAgICAgICAgICAgICAgICAgICBvbkNsb3NlPXt0aGlzLmNsb3NlTGlnaHRib3h9XG5cdFx0ICAgIG9uQ2xpY2tQcmV2PXt0aGlzLmdvdG9QcmV2aW91c31cblx0XHQgICAgb25DbGlja05leHQ9e3RoaXMuZ290b05leHR9XG4gICAgICAgICAgICAgICAgICAgIHdpZHRoPXsxNjAwfVxuICAgICAgICAgICAgICAgICAgICBoZWlnaHQ9ezE2MDB9XG4gICAgICAgICAgICAgICAgICAgIHN0eWxlcz17dGhpcy5wcm9wcy5saWdodGJveFN0eWxlc31cbiAgICAgICAgICAgICAgICAvPlxuICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICk7XG4gICAgfVxufSk7XG4vLyBHYWxsZXJ5IGltYWdlIHN0eWxlXG5jb25zdCBzdHlsZSA9IHtcbiAgIGRpc3BsYXk6ICdibG9jaycsXG4gICBtYXJnaW46IDIsXG4gICBiYWNrZ3JvdW5kQ29sb3I6JyNlM2UzZTMnLFxuICAgZmxvYXQ6ICdsZWZ0J1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IEdhbGxlcnk7XG4iXX0=
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9yZWFjdC1jb21wb25lbnQtZ3VscC10YXNrcy9ub2RlX21vZHVsZXMvYnJvd3NlcmlmeS9ub2RlX21vZHVsZXMvYnJvd3Nlci1wYWNrL19wcmVsdWRlLmpzIiwiL1VzZXJzL2h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GUgcGFydGljdWxhciBzZXRcbiAgICAgICAgICAgIHZhciBhc3BlY3RSYXRpbz0wLFxuICAgICAgICAgICAgICAgIHRvdGFsQXI9MCxcbiAgICAgICAgICAgICAgICBjb21tb25IZWlnaHQgPSAwO1xuICAgICAgICAgICAgZm9yICh2YXIgaj1pOyBqPGkrcm93TGltaXQ7IGorKyl7XG4gICAgICAgICAgICAgICAgaWYgKGogPT0gdGhpcy5wcm9wcy5waG90b3MubGVuZ3RoKXtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXHRcdHRvdGFsQXIgKz0gdGhpcy5wcm9wcy5waG90b3Nbal0uYXNwZWN0UmF0aW87XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb21tb25IZWlnaHQgPSBjb250V2lkdGggLyB0b3RhbEFyO1xuICAgICAgICAgICAgLy8gcnVuIHRocnUgdGhlIHNhbWUgc2V0IG9mIGl0ZW1zIGFnYWluIHRvIGdpdmUgdGhlIGNvbW1vbiBoZWlnaHRcbiAgICAgICAgICAgIGZvciAodmFyIGs9aTsgazxpK3Jvd0xpbWl0OyBrKyspe1xuICAgICAgICAgICAgICAgIGlmIChrID09IHRoaXMucHJvcHMucGhvdG9zLmxlbmd0aCl7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cblx0XHRsaWdodGJveEltYWdlcy5wdXNoKHRoaXMucHJvcHMucGhvdG9zW2tdLmxpZ2h0Ym94SW1hZ2UpO1xuXHRcdHZhciBzcmMgPSB0aGlzLnByb3BzLnBob3Rvc1trXS5zcmM7XG4gICAgICAgICAgICAgICAgcGhvdG9QcmV2aWV3Tm9kZXMucHVzaChcbiAgICAgICAgICAgICAgICAgICAgIDxkaXYga2V5PXtrfSBzdHlsZT17c3R5bGV9PlxuICAgICAgICAgICAgICAgICAgICAgICAgPGEgaHJlZj1cIiNcIiBjbGFzc05hbWU9e2t9IG9uQ2xpY2s9e3RoaXMub3BlbkxpZ2h0Ym94LmJpbmQodGhpcywgayl9PjxpbWcgc3JjPXtzcmN9IHN0eWxlPXt7ZGlzcGxheTonYmxvY2snLCBib3JkZXI6MH19IGhlaWdodD17Y29tbW9uSGVpZ2h0fSB3aWR0aD17Y29tbW9uSGVpZ2h0ICogdGhpcy5wcm9wcy5waG90b3Nba10uYXNwZWN0UmF0aW99IGFsdD1cIlwiIC8+PC9hPlxuICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXHRyZXR1cm4oXG4gICAgICAgICAgICA8ZGl2IGlkPVwiR2FsbGVyeVwiIGNsYXNzTmFtZT1cImNsZWFyZml4XCI+XG4gICAgICAgICAgICAgICAge3Bob3RvUHJldmlld05vZGVzfVxuICAgICAgICAgICAgICAgIDxMaWdodGJveFxuXHRcdCAgICBjdXJyZW50SW1hZ2U9e3RoaXMuc3RhdGUuY3VycmVudEltYWdlfVxuICAgICAgICAgICAgICAgICAgICBpbWFnZXM9e2xpZ2h0Ym94SW1hZ2VzfVxuICAgICAgICAgICAgICAgICAgICBpc09wZW49e3RoaXMuc3RhdGUubGlnaHRib3hJc09wZW59XG4gICAgICAgICAgICAgICAgICAgIG9uQ2xvc2U9e3RoaXMuY2xvc2VMaWdodGJveH1cblx0XHQgICAgb25DbGlja1ByZXY9e3RoaXMuZ290b1ByZXZpb3VzfVxuXHRcdCAgICBvbkNsaWNrTmV4dD17dGhpcy5nb3RvTmV4dH1cbiAgICAgICAgICAgICAgICAgICAgd2lkdGg9ezE2MDB9XG4gICAgICAgICAgICAgICAgICAgIGhlaWdodD17MTYwMH1cbiAgICAgICAgICAgICAgICAgICAgc3R5bGVzPXt0aGlzLnByb3BzLmxpZ2h0Ym94U3R5bGVzfVxuICAgICAgICAgICAgICAgIC8+XG4gICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgKTtcbiAgICB9XG59O1xuR2FsbGVyeS5kaXNwbGF5TmFtZSA9ICdHYWxsZXJ5JztcbkdhbGxlcnkucHJvcFR5cGVzID0ge1xuICAgIHBob3RvczogUmVhY3QuUHJvcFR5cGVzLmFycmF5T2YoXG5cdFJlYWN0LlByb3BUeXBlcy5zaGFwZSh7XG5cdCAgICBzcmM6IFJlYWN0LlByb3BUeXBlcy5zdHJpbmcuaXNSZXF1aXJlZCxcblx0ICAgIHdpZHRoOiBSZWFjdC5Qcm9wVHlwZXMubnVtYmVyLmlzUmVxdWlyZWQsXG5cdCAgICBoZWlnaHQ6IFJlYWN0LlByb3BUeXBlcy5udW1iZXIuaXNSZXF1aXJlZCxcblx0ICAgIGFzcGVjdFJhdGlvOiBSZWFjdC5Qcm9wVHlwZXMubnVtYmVyLmlzUmVxdWlyZWQsXG5cdCAgICBsaWdodGJveEltYWdlOiBSZWFjdC5Qcm9wVHlwZXMub2JqZWN0LmlzUmVxdWlyZWRcblx0fSlcbiAgICApLmlzUmVxdWlyZWQsXG59O1xuLy8gR2FsbGVyeSBpbWFnZSBzdHlsZVxuY29uc3Qgc3R5bGUgPSB7XG4gICBkaXNwbGF5OiAnYmxvY2snLFxuICAgbWFyZ2luOiAyLFxuICAgYmFja2dyb3VuZENvbG9yOicjZTNlM2UzJyxcbiAgIGZsb2F0OiAnbGVmdCdcbn1cblxuZXhwb3J0IGRlZmF1bHQgR2FsbGVyeTtcbiJdfQ==

@@ -5,4 +5,16 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Gallery = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);

@@ -20,116 +32,148 @@

var Gallery = _react2['default'].createClass({
displayName: 'Gallery',
propTypes: {
photos: _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.shape({
src: _react2['default'].PropTypes.string.isRequired,
width: _react2['default'].PropTypes.number.isRequired,
height: _react2['default'].PropTypes.number.isRequired,
aspectRatio: _react2['default'].PropTypes.number.isRequired,
lightboxImage: _react2['default'].PropTypes.object.isRequired
})).isRequired
},
getInitialState: function getInitialState() {
return {
var Gallery = (function (_React$Component) {
_inherits(Gallery, _React$Component);
function Gallery() {
_classCallCheck(this, Gallery);
_get(Object.getPrototypeOf(Gallery.prototype), 'constructor', this).call(this);
this.state = {
currentImage: 0,
containerWidth: 0
};
},
componentDidMount: function componentDidMount() {
this.setState({ containerWidth: Math.floor(_reactDom2['default'].findDOMNode(this).clientWidth) });
window.addEventListener('resize', this.handleResize);
},
componentDidUpdate: function componentDidUpdate() {
if (_reactDom2['default'].findDOMNode(this).clientWidth !== this.state.containerWidth) {
this.handleResize = this.handleResize.bind(this);
this.closeLightbox = this.closeLightbox.bind(this);
this.gotoNext = this.gotoNext.bind(this);
this.gotoPrevious = this.gotoPrevious.bind(this);
this.openLightbox = this.openLightbox.bind(this);
}
_createClass(Gallery, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.setState({ containerWidth: Math.floor(_reactDom2['default'].findDOMNode(this).clientWidth) });
window.addEventListener('resize', this.handleResize);
}
},
handleResize: function handleResize(e) {
this.setState({ containerWidth: Math.floor(_reactDom2['default'].findDOMNode(this).clientWidth) });
},
openLightbox: function openLightbox(index, event) {
event.preventDefault();
this.setState({
currentImage: index,
lightboxIsOpen: true
});
},
closeLightbox: function closeLightbox() {
this.setState({
currentImage: 0,
lightboxIsOpen: false
});
},
gotoPrevious: function gotoPrevious() {
this.setState({
currentImage: this.state.currentImage - 1
});
},
gotoNext: function gotoNext() {
this.setState({
currentImage: this.state.currentImage + 1
});
},
render: function render() {
var rowLimit = 1,
photoPreviewNodes = [];
if (this.state.containerWidth >= 480) {
rowLimit = 2;
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
if (_reactDom2['default'].findDOMNode(this).clientWidth !== this.state.containerWidth) {
this.setState({ containerWidth: Math.floor(_reactDom2['default'].findDOMNode(this).clientWidth) });
}
}
if (this.state.containerWidth >= 1024) {
rowLimit = 3;
}, {
key: 'handleResize',
value: function handleResize(e) {
this.setState({ containerWidth: Math.floor(_reactDom2['default'].findDOMNode(this).clientWidth) });
}
var contWidth = this.state.containerWidth - rowLimit * 4; /* 4px for margin around each image*/
contWidth = Math.floor(contWidth - 2); // add some padding to prevent layout prob
var lightboxImages = [];
for (var i = 0; i < this.props.photos.length; i += rowLimit) {
var rowItems = [];
// loop thru each set of rowLimit num
// eg. if rowLimit is 3 it will loop thru 0,1,2, then 3,4,5 to perform calculations for the particular set
var aspectRatio = 0,
totalAr = 0,
commonHeight = 0;
for (var j = i; j < i + rowLimit; j++) {
if (j == this.props.photos.length) {
break;
}
totalAr += this.props.photos[j].aspectRatio;
}, {
key: 'openLightbox',
value: function openLightbox(index, event) {
event.preventDefault();
this.setState({
currentImage: index,
lightboxIsOpen: true
});
}
}, {
key: 'closeLightbox',
value: function closeLightbox() {
this.setState({
currentImage: 0,
lightboxIsOpen: false
});
}
}, {
key: 'gotoPrevious',
value: function gotoPrevious() {
this.setState({
currentImage: this.state.currentImage - 1
});
}
}, {
key: 'gotoNext',
value: function gotoNext() {
this.setState({
currentImage: this.state.currentImage + 1
});
}
}, {
key: 'render',
value: function render() {
var rowLimit = 1,
photoPreviewNodes = [];
if (this.state.containerWidth >= 480) {
rowLimit = 2;
}
commonHeight = contWidth / totalAr;
// run thru the same set of items again to give the common height
for (var k = i; k < i + rowLimit; k++) {
if (k == this.props.photos.length) {
break;
if (this.state.containerWidth >= 1024) {
rowLimit = 3;
}
var contWidth = this.state.containerWidth - rowLimit * 4; /* 4px for margin around each image*/
contWidth = Math.floor(contWidth - 2); // add some padding to prevent layout prob
var lightboxImages = [];
for (var i = 0; i < this.props.photos.length; i += rowLimit) {
var rowItems = [];
// loop thru each set of rowLimit num
// eg. if rowLimit is 3 it will loop thru 0,1,2, then 3,4,5 to perform calculations for the particular set
var aspectRatio = 0,
totalAr = 0,
commonHeight = 0;
for (var j = i; j < i + rowLimit; j++) {
if (j == this.props.photos.length) {
break;
}
totalAr += this.props.photos[j].aspectRatio;
}
lightboxImages.push(this.props.photos[k].lightboxImage);
var src = this.props.photos[k].src;
photoPreviewNodes.push(_react2['default'].createElement(
'div',
{ key: k, style: style },
_react2['default'].createElement(
'a',
{ href: '#', className: k, onClick: this.openLightbox.bind(this, k) },
_react2['default'].createElement('img', { src: src, style: { display: 'block', border: 0 }, height: commonHeight, width: commonHeight * this.props.photos[k].aspectRatio, alt: '' })
)
));
commonHeight = contWidth / totalAr;
// run thru the same set of items again to give the common height
for (var k = i; k < i + rowLimit; k++) {
if (k == this.props.photos.length) {
break;
}
lightboxImages.push(this.props.photos[k].lightboxImage);
var src = this.props.photos[k].src;
photoPreviewNodes.push(_react2['default'].createElement(
'div',
{ key: k, style: style },
_react2['default'].createElement(
'a',
{ href: '#', className: k, onClick: this.openLightbox.bind(this, k) },
_react2['default'].createElement('img', { src: src, style: { display: 'block', border: 0 }, height: commonHeight, width: commonHeight * this.props.photos[k].aspectRatio, alt: '' })
)
));
}
}
return _react2['default'].createElement(
'div',
{ id: 'Gallery', className: 'clearfix' },
photoPreviewNodes,
_react2['default'].createElement(_reactImages2['default'], {
currentImage: this.state.currentImage,
images: lightboxImages,
isOpen: this.state.lightboxIsOpen,
onClose: this.closeLightbox,
onClickPrev: this.gotoPrevious,
onClickNext: this.gotoNext,
width: 1600,
height: 1600,
styles: this.props.lightboxStyles
})
);
}
return _react2['default'].createElement(
'div',
{ id: 'Gallery', className: 'clearfix' },
photoPreviewNodes,
_react2['default'].createElement(_reactImages2['default'], {
currentImage: this.state.currentImage,
images: lightboxImages,
isOpen: this.state.lightboxIsOpen,
onClose: this.closeLightbox,
onClickPrev: this.gotoPrevious,
onClickNext: this.gotoNext,
width: 1600,
height: 1600,
styles: this.props.lightboxStyles
})
);
}
});
}]);
return Gallery;
})(_react2['default'].Component);
;
Gallery.displayName = 'Gallery';
Gallery.propTypes = {
photos: _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.shape({
src: _react2['default'].PropTypes.string.isRequired,
width: _react2['default'].PropTypes.number.isRequired,
height: _react2['default'].PropTypes.number.isRequired,
aspectRatio: _react2['default'].PropTypes.number.isRequired,
lightboxImage: _react2['default'].PropTypes.object.isRequired
})).isRequired
};
// Gallery image style

@@ -143,3 +187,4 @@ var style = {

module.exports = Gallery;
exports['default'] = Gallery;
module.exports = exports['default'];

@@ -146,0 +191,0 @@ }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})

@@ -17,17 +17,21 @@ import React from 'react';

var App = React.createClass({
getInitialState: function(){
return {photos:null, pageNum:1, totalPages:1, loadedAll: false};
},
componentDidMount: function() {
class App extends React.Component{
constructor(){
super();
this.state = {photos:null, pageNum:1, totalPages:1, loadedAll: false};
this.handleScroll = this.handleScroll.bind(this);
this.loadMorePhotos = this.loadMorePhotos.bind(this);
}
componentDidMount() {
this.loadMorePhotos();
this.loadMorePhotos = _.debounce(this.loadMorePhotos, 200);
window.addEventListener('scroll', this.handleScroll);
},
handleScroll: function(e){
}
handleScroll(){
if ((window.innerHeight + window.scrollY) >= (document.body.offsetHeight - 50)) {
this.loadMorePhotos();
}
},
loadMorePhotos: function(e){
}
loadMorePhotos(e){
if (e){

@@ -66,3 +70,3 @@ e.preventDefault();

});
},
}
renderGallery(){

@@ -72,4 +76,4 @@ return(

);
},
render: function(){
}
render(){
// no loading sign if its all loaded

@@ -99,4 +103,4 @@ if (this.state.photos && this.state.loadedAll){

}
});
};
ReactDOM.render(<App />, document.getElementById('app'));
{
"name": "react-photo-gallery",
"version": "3.0.2",
"version": "3.0.3",
"description": "Responsive React Photo Gallery Component",

@@ -17,2 +17,3 @@ "main": "lib/Gallery.js",

"dependencies": {
"react": ">=0.14",
"react-dom": "^0.14.2",

@@ -29,3 +30,2 @@ "react-images": "^0.2.1"

"lodash": "^3.10.1",
"react": ">=0.14",
"react-component-gulp-tasks": "^0.7.0"

@@ -32,0 +32,0 @@ },

@@ -5,34 +5,28 @@ import React from 'react';

var Gallery = React.createClass({
displayName: 'Gallery',
propTypes:{
photos: React.PropTypes.arrayOf(
React.PropTypes.shape({
src: React.PropTypes.string.isRequired,
width: React.PropTypes.number.isRequired,
height: React.PropTypes.number.isRequired,
aspectRatio: React.PropTypes.number.isRequired,
lightboxImage: React.PropTypes.object.isRequired
})
).isRequired,
},
getInitialState: function(){
return {
class Gallery extends React.Component{
constructor(){
super();
this.state = {
currentImage: 0,
containerWidth: 0
}
},
componentDidMount: function(){
};
this.handleResize = this.handleResize.bind(this);
this.closeLightbox = this.closeLightbox.bind(this);
this.gotoNext = this.gotoNext.bind(this);
this.gotoPrevious = this.gotoPrevious.bind(this);
this.openLightbox = this.openLightbox.bind(this);
}
componentDidMount(){
this.setState({containerWidth: Math.floor(ReactDOM.findDOMNode(this).clientWidth)})
window.addEventListener('resize', this.handleResize);
},
componentDidUpdate: function(){
}
componentDidUpdate(){
if (ReactDOM.findDOMNode(this).clientWidth !== this.state.containerWidth){
this.setState({containerWidth: Math.floor(ReactDOM.findDOMNode(this).clientWidth)});
}
},
handleResize: function(e){
}
handleResize(e){
this.setState({containerWidth: Math.floor(ReactDOM.findDOMNode(this).clientWidth)});
},
openLightbox (index, event) {
}
openLightbox(index, event){
event.preventDefault();

@@ -43,4 +37,4 @@ this.setState({

});
},
closeLightbox () {
}
closeLightbox(){
this.setState({

@@ -50,14 +44,14 @@ currentImage: 0,

});
},
gotoPrevious () {
}
gotoPrevious(){
this.setState({
currentImage: this.state.currentImage - 1,
});
},
gotoNext () {
}
gotoNext(){
this.setState({
currentImage: this.state.currentImage + 1,
});
},
render: function(){
}
render(){
var rowLimit = 1,

@@ -119,3 +113,15 @@ photoPreviewNodes = [];

}
});
};
Gallery.displayName = 'Gallery';
Gallery.propTypes = {
photos: React.PropTypes.arrayOf(
React.PropTypes.shape({
src: React.PropTypes.string.isRequired,
width: React.PropTypes.number.isRequired,
height: React.PropTypes.number.isRequired,
aspectRatio: React.PropTypes.number.isRequired,
lightboxImage: React.PropTypes.object.isRequired
})
).isRequired,
};
// Gallery image style

@@ -129,2 +135,2 @@ const style = {

module.exports = Gallery;
export default Gallery;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc