2015-11-20 10:57:08 +08:00
|
|
|
// matchMedia polyfill for
|
|
|
|
// https://github.com/WickyNilliams/enquire.js/issues/82
|
|
|
|
if (typeof window !== 'undefined') {
|
|
|
|
const matchMediaPolyfill = function matchMediaPolyfill() {
|
|
|
|
return {
|
|
|
|
matches: false,
|
2016-01-05 14:42:06 +08:00
|
|
|
addListener() {
|
|
|
|
},
|
|
|
|
removeListener() {
|
2015-11-20 10:57:08 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
window.matchMedia = window.matchMedia || matchMediaPolyfill;
|
|
|
|
}
|
|
|
|
|
2016-03-21 09:22:14 +08:00
|
|
|
import SlickCarousel from 'react-slick';
|
2015-08-03 14:52:26 +08:00
|
|
|
import React from 'react';
|
|
|
|
|
2016-03-21 09:22:14 +08:00
|
|
|
export default class Carousel extends React.Component {
|
2016-03-29 14:01:10 +08:00
|
|
|
static defaultProps = {
|
|
|
|
dots: true,
|
|
|
|
arrows: false,
|
2016-09-01 12:22:03 +08:00
|
|
|
pauseOnHover: true,
|
2016-03-29 14:01:10 +08:00
|
|
|
}
|
|
|
|
|
2015-08-03 14:52:26 +08:00
|
|
|
render() {
|
2016-03-25 18:16:48 +08:00
|
|
|
let props = { ...this.props };
|
2015-08-03 14:52:26 +08:00
|
|
|
|
|
|
|
if (props.effect === 'fade') {
|
|
|
|
props.fade = true;
|
2015-08-28 13:55:36 +08:00
|
|
|
props.draggable = false;
|
2015-08-03 14:52:26 +08:00
|
|
|
}
|
|
|
|
|
2015-08-17 15:17:04 +08:00
|
|
|
let className = 'ant-carousel';
|
2015-08-03 14:52:26 +08:00
|
|
|
if (props.vertical) {
|
2016-02-17 18:04:42 +08:00
|
|
|
className = `${className} ant-carousel-vertical`;
|
2015-08-03 14:52:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={className}>
|
2016-03-21 09:22:14 +08:00
|
|
|
<SlickCarousel {...props} />
|
2015-08-03 14:52:26 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2016-03-21 09:22:14 +08:00
|
|
|
}
|