Skip to content

Commit

Permalink
build 6.0.28
Browse files Browse the repository at this point in the history
  • Loading branch information
neptunian committed Jun 9, 2018
1 parent 58543f0 commit fc5e3b4
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 150 deletions.
70 changes: 25 additions & 45 deletions dist/react-photo-gallery.es.js
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import React from 'react';
import PropTypes from 'prop-types';

var asyncGenerator = function () {
Expand Down Expand Up @@ -228,55 +228,33 @@ var toConsumableArray = function (arr) {

var imgWithClick = { cursor: 'pointer' };

var Photo = function (_PureComponent) {
inherits(Photo, _PureComponent);
var Photo = function Photo(_ref) {
var index = _ref.index,
onClick = _ref.onClick,
photo = _ref.photo,
margin = _ref.margin;

function Photo() {
classCallCheck(this, Photo);
var imgStyle = { display: 'block', float: 'left', margin: margin };

var _this = possibleConstructorReturn(this, (Photo.__proto__ || Object.getPrototypeOf(Photo)).call(this));

_this.handleClick = _this.handleClick.bind(_this);
return _this;
}

createClass(Photo, [{
key: 'handleClick',
value: function handleClick(event) {
var _props = this.props,
onClick = _props.onClick,
index = _props.index,
photo = _props.photo;
var handleClick = function handleClick(event) {
onClick(event, { photo: photo, index: index });
};

onClick(event, { photo: photo, index: index });
}
}, {
key: 'render',
value: function render() {
var _props2 = this.props,
photo = _props2.photo,
onClick = _props2.onClick,
margin = _props2.margin;

var imgStyle = { display: 'block', float: 'left', margin: margin };
return React.createElement('img', _extends({
style: onClick ? _extends({}, imgStyle, imgWithClick) : imgStyle
}, photo, {
onClick: onClick ? this.handleClick : null
}));
}
}]);
return Photo;
}(PureComponent);
return React.createElement('img', _extends({
style: onClick ? _extends({}, imgStyle, imgWithClick) : imgStyle
}, photo, {
onClick: onClick ? handleClick : null
}));
};

var photoPropType = PropTypes.shape({
src: PropTypes.string.isRequired,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
alt: PropTypes.string,
title: PropTypes.string,
srcSet: PropTypes.array,
sizes: PropTypes.array
srcSet: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
sizes: PropTypes.oneOfType([PropTypes.string, PropTypes.array])
});

Photo.propTypes = {
Expand Down Expand Up @@ -362,11 +340,13 @@ var Gallery = function (_React$Component) {
// this is to fix non-ios browsers where a scrollbar isnt present before
// images load, then becomes present, and doesn't trigger an update.
// avoids calling setState in componentDidUpdate causing maximum depth exceeded error
window.requestAnimationFrame(function () {
if (that._gallery.clientWidth !== that.state.containerWidth) {
that.setState({ containerWidth: Math.floor(that._gallery.clientWidth) });
}
});
if (typeof window !== 'undefined') {
window.requestAnimationFrame(function () {
if (that._gallery.clientWidth !== that.state.containerWidth) {
that.setState({ containerWidth: Math.floor(that._gallery.clientWidth) });
}
});
}
return _this;
}

Expand Down
80 changes: 30 additions & 50 deletions dist/react-photo-gallery.js
Expand Up @@ -4,7 +4,7 @@
(global.Gallery = factory(global.React,global.PropTypes));
}(this, (function (React,PropTypes) { 'use strict';

var React__default = 'default' in React ? React['default'] : React;
React = React && React.hasOwnProperty('default') ? React['default'] : React;
PropTypes = PropTypes && PropTypes.hasOwnProperty('default') ? PropTypes['default'] : PropTypes;

var asyncGenerator = function () {
Expand Down Expand Up @@ -234,55 +234,33 @@ var toConsumableArray = function (arr) {

var imgWithClick = { cursor: 'pointer' };

var Photo = function (_PureComponent) {
inherits(Photo, _PureComponent);
var Photo = function Photo(_ref) {
var index = _ref.index,
onClick = _ref.onClick,
photo = _ref.photo,
margin = _ref.margin;

function Photo() {
classCallCheck(this, Photo);
var imgStyle = { display: 'block', float: 'left', margin: margin };

var _this = possibleConstructorReturn(this, (Photo.__proto__ || Object.getPrototypeOf(Photo)).call(this));

_this.handleClick = _this.handleClick.bind(_this);
return _this;
}

createClass(Photo, [{
key: 'handleClick',
value: function handleClick(event) {
var _props = this.props,
onClick = _props.onClick,
index = _props.index,
photo = _props.photo;
var handleClick = function handleClick(event) {
onClick(event, { photo: photo, index: index });
};

onClick(event, { photo: photo, index: index });
}
}, {
key: 'render',
value: function render() {
var _props2 = this.props,
photo = _props2.photo,
onClick = _props2.onClick,
margin = _props2.margin;

var imgStyle = { display: 'block', float: 'left', margin: margin };
return React__default.createElement('img', _extends({
style: onClick ? _extends({}, imgStyle, imgWithClick) : imgStyle
}, photo, {
onClick: onClick ? this.handleClick : null
}));
}
}]);
return Photo;
}(React.PureComponent);
return React.createElement('img', _extends({
style: onClick ? _extends({}, imgStyle, imgWithClick) : imgStyle
}, photo, {
onClick: onClick ? handleClick : null
}));
};

var photoPropType = PropTypes.shape({
src: PropTypes.string.isRequired,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
alt: PropTypes.string,
title: PropTypes.string,
srcSet: PropTypes.array,
sizes: PropTypes.array
srcSet: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
sizes: PropTypes.oneOfType([PropTypes.string, PropTypes.array])
});

Photo.propTypes = {
Expand Down Expand Up @@ -368,11 +346,13 @@ var Gallery = function (_React$Component) {
// this is to fix non-ios browsers where a scrollbar isnt present before
// images load, then becomes present, and doesn't trigger an update.
// avoids calling setState in componentDidUpdate causing maximum depth exceeded error
window.requestAnimationFrame(function () {
if (that._gallery.clientWidth !== that.state.containerWidth) {
that.setState({ containerWidth: Math.floor(that._gallery.clientWidth) });
}
});
if (typeof window !== 'undefined') {
window.requestAnimationFrame(function () {
if (that._gallery.clientWidth !== that.state.containerWidth) {
that.setState({ containerWidth: Math.floor(that._gallery.clientWidth) });
}
});
}
return _this;
}

Expand Down Expand Up @@ -426,16 +406,16 @@ var Gallery = function (_React$Component) {
onClick = _props2.onClick;

var thumbs = computeSizes({ width: width, columns: columns, margin: margin, photos: photos });
return React__default.createElement(
return React.createElement(
'div',
{ className: 'react-photo-gallery--gallery' },
React__default.createElement(
React.createElement(
'div',
{ ref: function ref(c) {
return _this2._gallery = c;
} },
thumbs.map(function (photo, index) {
return React__default.createElement(ImageComponent, {
return React.createElement(ImageComponent, {
key: photo.key || photo.src,
margin: margin,
index: index,
Expand All @@ -444,12 +424,12 @@ var Gallery = function (_React$Component) {
});
})
),
React__default.createElement('div', { style: { content: '', display: 'table', clear: 'both' } })
React.createElement('div', { style: { content: '', display: 'table', clear: 'both' } })
);
}
}]);
return Gallery;
}(React__default.Component);
}(React.Component);

Gallery.propTypes = {
photos: PropTypes.arrayOf(photoPropType).isRequired,
Expand Down
2 changes: 1 addition & 1 deletion dist/react-photo-gallery.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions lib/Gallery.js
Expand Up @@ -46,11 +46,13 @@ var Gallery = function (_React$Component) {
// this is to fix non-ios browsers where a scrollbar isnt present before
// images load, then becomes present, and doesn't trigger an update.
// avoids calling setState in componentDidUpdate causing maximum depth exceeded error
window.requestAnimationFrame(function () {
if (that._gallery.clientWidth !== that.state.containerWidth) {
that.setState({ containerWidth: Math.floor(that._gallery.clientWidth) });
}
});
if (typeof window !== 'undefined') {
window.requestAnimationFrame(function () {
if (that._gallery.clientWidth !== that.state.containerWidth) {
that.setState({ containerWidth: Math.floor(that._gallery.clientWidth) });
}
});
}
return _this;
}

Expand Down

0 comments on commit fc5e3b4

Please sign in to comment.