scratch-www/src/components/carousel/carousel.jsx

43 lines
1.3 KiB
React
Raw Normal View History

2015-09-08 14:56:28 -04:00
var React = require('react');
var Slider = require('react-slick');
var Thumbnail = require('../thumbnail/thumbnail.jsx');
require('slick-carousel/slick/slick.scss');
require('slick-carousel/slick/slick-theme.scss');
require('./carousel.scss');
module.exports = React.createClass({
propTypes: {
items: React.PropTypes.array
},
getDefaultProps: function () {
return {
items: require('./carousel.json'),
settings: {
arrows: true,
dots: false,
infinite: false,
lazyLoad: true,
slidesToShow: 5,
slidesToScroll: 5,
variableWidth: true
}
};
},
render: function () {
return (
<Slider className={'carousel ' + this.props.className} {... this.props.settings}>
2015-09-10 15:00:07 -04:00
{this.props.items.map(function (item) {
2015-09-08 14:56:28 -04:00
return (
<Thumbnail key={item.id}
2015-09-08 18:15:02 -04:00
href={item.href}
2015-09-08 14:56:28 -04:00
title={item.title}
2015-09-08 18:15:02 -04:00
src={item.thumbnailUrl}
extra={item.creator ? 'by ' + item.creator:null} />
2015-09-08 14:56:28 -04:00
);
})}
</Slider>
);
}
});