Skip to content

Commit 88c1547

Browse files
author
ben
committed
v0.5.3
1 parent a0d0ecb commit 88c1547

File tree

6 files changed

+30
-15
lines changed

6 files changed

+30
-15
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# react-grid-gallery
22

3+
### v0.5.3 / 2018-09-30
4+
5+
* Added `nano` prop and functionality for base64 4x4 image placeholders [PR 101](https://github.com/benhowell/react-grid-gallery/pull/101). Thanks [Vadimuz](https://github.com/vadimuz).
6+
37
### v0.5.2 / 2018-09-15
48

59
* Added currentImageWillChange [PR 97](https://github.com/benhowell/react-grid-gallery/pull/97). Function to execute before lightbox image change. Useful for tracking current image shown in lightbox. Thanks [Approximator](https://github.com/approximator).

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ src | string | undefined | Required. A string ref
6666
thumbnail | string | undefined | Required. A string referring to any valid image resource (file, url, etc).
6767
thumbnailWidth | number | undefined | Required. Width of the thumbnail image.
6868
thumbnailHeight | number | undefined | Required. Height of the thumbnail image.
69-
nano | string:base64 | undefined | Optional. Thumbnail Base64 image will be injected to background under the main image, that is waiting for a loading. This is super helpful and fancy if you receive base64 images 4x4 pixels from the server-side response.
69+
nano | string:base64 | undefined | Optional. Thumbnail Base64 image will be injected to background under the main image. This provides a base64, 4x4 generated image whilst the image is beong loaded.
7070
alt | string | "" | Optional. Image alt attribute.
7171
tags | array | undefined | Optional. An array of objects containing tag attributes (value and title). e.g. `{value: "foo", title: "bar"}`
7272
isSelected | bool | undefined | Optional. The selected state of the image.
@@ -195,6 +195,8 @@ React Grid Gallery is free to use for personal and commercial projects under the
195195

196196
* [Approximator](https://github.com/approximator) for currentImageWillChange (Function to execute before lightbox image change) [PR 97](https://github.com/benhowell/react-grid-gallery/pull/97).
197197

198+
* [Vadimuz](https://github.com/vadimuz) for nano image props and functionality [PR 101](https://github.com/benhowell/react-grid-gallery/pull/101).
199+
198200
* Demo stock photos:
199201
* [Jeshu John - designerspics.com](http://designerspics.com)
200202
* [Gratisography](http://gratisography.com)

lib/Gallery.js

+1
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ Gallery.displayName = 'Gallery';
356356
Gallery.propTypes = {
357357
images: _propTypes2.default.arrayOf(_propTypes2.default.shape({
358358
src: _propTypes2.default.string.isRequired,
359+
nano: _propTypes2.default.string,
359360
alt: _propTypes2.default.string,
360361
thumbnail: _propTypes2.default.string.isRequired,
361362
srcset: _propTypes2.default.array,

lib/Image.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,25 @@ var Image = function (_Component) {
6262
key: 'tileViewportStyle',
6363
value: function tileViewportStyle() {
6464
if (this.props.tileViewportStyle) return this.props.tileViewportStyle.call(this);
65-
if (this.props.item.isSelected) return {
65+
var nanoBase64Backgorund = {};
66+
if (this.props.item.nano) {
67+
nanoBase64Backgorund = {
68+
background: 'url(' + this.props.item.nano + ')',
69+
backgroundSize: 'cover',
70+
backgroundPosition: 'center center'
71+
};
72+
}
73+
if (this.props.item.isSelected) return Object.assign({
6674
width: this.props.item.vwidth - 32,
6775
height: this.props.height - 32,
6876
margin: 16,
6977
overflow: "hidden"
70-
};
71-
return {
78+
}, nanoBase64Backgorund);
79+
return Object.assign({
7280
width: this.props.item.vwidth,
7381
height: this.props.height,
7482
overflow: "hidden"
75-
};
83+
}, nanoBase64Backgorund);
7684
}
7785
}, {
7886
key: 'thumbnailStyle',

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

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

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

0 commit comments

Comments
 (0)