1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
import React from 'react';
import Slider from 'react-slick';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import ArrowForward from '@material-ui/icons/ArrowForward';
import ArrowBack from '@material-ui/icons/ArrowBack';
import carouselData from 'ba-api/carouselData';
import 'ba-styles/vendors/slick-carousel/slick-carousel.css';
import 'ba-styles/vendors/slick-carousel/slick.css';
import 'ba-styles/vendors/slick-carousel/slick-theme.css';
import { Typography, IconButton, Icon } from '@material-ui/core';
import styles from './widget-jss';
function SampleNextArrow(props) {
const { onClick } = props;
return (
<IconButton
className="nav-next"
onClick={onClick}
>
<ArrowForward />
</IconButton>
);
}
SampleNextArrow.propTypes = {
onClick: PropTypes.func,
};
SampleNextArrow.defaultProps = {
onClick: undefined,
};
function SamplePrevArrow(props) {
const { onClick } = props;
return (
<IconButton
className="nav-prev"
onClick={onClick}
>
<ArrowBack />
</IconButton>
);
}
SamplePrevArrow.propTypes = {
onClick: PropTypes.func,
};
SamplePrevArrow.defaultProps = {
onClick: undefined,
};
class CarouselWidget extends React.Component {
render() {
const { classes } = this.props;
const settings = {
dots: true,
infinite: true,
centerMode: false,
speed: 500,
autoplaySpeed: 5000,
pauseOnHover: true,
autoplay: true,
slidesToShow: 3,
slidesToScroll: 1,
responsive: [
{
breakpoint: 960,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
infinite: true,
dots: true
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: true
}
},
],
cssEase: 'ease-out',
nextArrow: <SampleNextArrow />,
prevArrow: <SamplePrevArrow />
};
return (
<div className="container custom-arrow">
<Slider {...settings}>
{carouselData.map((item, index) => (
<div key={index.toString()}>
<div style={{ backgroundColor: item.background }} className={classes.carouselItem}>
<Icon className={classes.iconBg}>{item.icon}</Icon>
<Typography className={classes.carouselTitle} variant="subtitle1">
<Icon>{item.icon}</Icon>
{item.title}
</Typography>
<Typography className={classes.carouselDesc}>{item.desc}</Typography>
</div>
</div>
))}
</Slider>
</div>
);
}
}
CarouselWidget.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(CarouselWidget);
|