react-masonry-component-4meteorhacks-npm
v0.0.13
Published
A masonry component for React.js by Eirik + dependency pointing to npm instead of github
Downloads
8
Maintainers
Readme
React Masonry Component
Introduction:
A React.js Masonry component. (Also available as a mixin if needed)
Live demo:
Usage:
The component is bundled with Masonry, so no additional dependencies needed!
You can optionally include Masonry as a script tag if the should be any reason for doing so
<script src='//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.5/masonry.pkgd.min.js' />
To use the component just require the module and inject
React
example code
var React = require('react');
var Masonry = require('react-masonry-component')(React);
var masonryOptions = {
transitionDuration: 0
};
var Gallery = React.createClass({
render: function () {
var childElements = this.props.elements.map(function(element){
return (
<li className="image-element-class">
<img src={element.src} />
</li>
);
});
return (
<Masonry
className={'my-gallery-class'} // default ''
elementType={'ul'} // default 'div'
options={masonryOptions} // default {}
disableImagesLoaded={false} // default false
>
{childElements}
</Masonry>
);
}
});
module.exports = Gallery;