-
Notifications
You must be signed in to change notification settings - Fork 160
/
ReactSlick.js
95 lines (87 loc) · 3.06 KB
/
ReactSlick.js
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
import React, { Component } from 'react';
import ReactImageMagnify from 'ReactImageMagnify';
import ReactSlick from 'react-slick';
import '../styles/react-slick.css';
import front_500 from '../images/versace-blue/front-500.jpg'
import front_779 from '../images/versace-blue/front-779.jpg';
import front_1020 from '../images/versace-blue/front-1020.jpg';
import front_1200 from '../images/versace-blue/front-1200.jpg';
import front_1426 from '../images/versace-blue/front-1426.jpg';
import back_500 from '../images/versace-blue/back-500.jpg'
import back_779 from '../images/versace-blue/back-779.jpg';
import back_1020 from '../images/versace-blue/back-1020.jpg';
import back_1200 from '../images/versace-blue/back-1200.jpg';
import back_1426 from '../images/versace-blue/back-1426.jpg';
const frontSrcSet = [
{ src: front_500, setting: '500w' },
{ src: front_779, setting: '779w' },
{ src: front_1020, setting: '1020w' },
{ src: front_1200, setting: '1200w' },
{ src: front_1426, setting: '1426w' }
]
.map(item => `${item.src} ${item.setting}`)
.join(', ');
const backSrcSet = [
{ src: back_500, setting: '500w' },
{ src: back_779, setting: '779w' },
{ src: back_1020, setting: '1020w' },
{ src: back_1200, setting: '1200w' },
{ src: back_1426, setting: '1426w' }
]
.map(item => `${item.src} ${item.setting}`)
.join(', ');
const dataSource = [
{
srcSet: frontSrcSet,
small: front_500,
large: front_1426
},
{
srcSet: backSrcSet,
small: back_500,
large: back_1426
}
];
export default class ReactSlickExample extends Component {
render() {
const {
rimProps,
rsProps
} = this.props;
return (
<ReactSlick
{...{
dots: true,
infinite: true,
speed: 500,
slidesToShow: 1,
slidesToScroll: 1
}}
{...rsProps}
>
{dataSource.map((src, index) => (
<div key={index}>
<ReactImageMagnify
{...{
smallImage: {
alt: 'Wristwatch by Versace',
isFluidWidth: true,
src: src.small,
srcSet: src.srcSet,
sizes: '(max-width: 480px) 100vw, (max-width: 1200px) 30vw, 360px'
},
largeImage: {
src: src.large,
width: 1426,
height: 2000
},
lensStyle: { backgroundColor: 'rgba(0,0,0,.6)' }
}}
{...rimProps}
/>
</div>
))}
</ReactSlick>
);
}
}