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 (
|
2015-09-09 09:53:48 -04:00
|
|
|
<Slider className={'carousel ' + this.props.className} {... this.props.settings}>
|
2015-09-10 15:00:07 -04:00
|
|
|
{this.props.items.map(function (item) {
|
2015-10-02 13:08:57 -04:00
|
|
|
var href = '';
|
|
|
|
switch (item.type) {
|
|
|
|
case 'gallery':
|
|
|
|
href = '/studio/' + item.id + '/';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
href = '/' + item.type + '/' + item.id + '/';
|
|
|
|
}
|
|
|
|
|
2015-09-08 14:56:28 -04:00
|
|
|
return (
|
|
|
|
<Thumbnail key={item.id}
|
2015-10-02 13:08:57 -04:00
|
|
|
type={item.type}
|
|
|
|
href={href}
|
2015-09-08 14:56:28 -04:00
|
|
|
title={item.title}
|
2015-10-06 13:07:24 -04:00
|
|
|
src={item.thumbnailUrl}
|
2015-10-02 13:08:57 -04:00
|
|
|
creator={item.creator}
|
|
|
|
remixes={item.remixes}
|
|
|
|
loves={item.loves} />
|
2015-09-08 14:56:28 -04:00
|
|
|
);
|
2015-10-06 13:07:24 -04:00
|
|
|
})}
|
2015-09-08 14:56:28 -04:00
|
|
|
</Slider>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|