react-img-carousel
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -102,3 +102,4 @@ 'use strict'; | ||
track: _react.PropTypes.object, | ||
slide: _react.PropTypes.object | ||
slide: _react.PropTypes.object, | ||
selectedSlide: _react.PropTypes.object | ||
}) | ||
@@ -610,7 +611,7 @@ }; | ||
}); | ||
var slideStyle = (0, _lodash4.default)({}, style.slide || {}, { | ||
var slideStyle = { | ||
marginLeft: cellPadding + 'px', | ||
height: slideHeight, | ||
width: slideWidth | ||
}); | ||
}; | ||
@@ -631,2 +632,4 @@ if (transition === 'fade') { | ||
slideStyle = (0, _lodash4.default)({}, slideStyle, style.slide || {}, index === currentSlide ? style.selectedSlide || {} : {}); | ||
var loadingSlideStyle = { | ||
@@ -633,0 +636,0 @@ marginLeft: slideStyle.marginLeft, |
{ | ||
"name": "react-img-carousel", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Provides an image carousel React component.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -131,3 +131,4 @@ # react-img-carousel | ||
track: PropTypes.object, | ||
slide: PropTypes.object | ||
slide: PropTypes.object, | ||
selectedSlide: PropTypes.object | ||
}) | ||
@@ -138,4 +139,23 @@ ``` | ||
elements. The properties correspond to the DOM elements with class names `carousel`, `carousel-container-inner`, | ||
`carousel-viewport`, `carousel-track`, and `carousel-slide` respectively. | ||
`carousel-viewport`, `carousel-track`, `carousel-slide`, and `carousel-slide-selected` respectively. If both `slide` | ||
and `selectedSlide` are specified, both will be applied with the latter overriding the former. | ||
Example: | ||
``` | ||
<Carousel | ||
... | ||
style={{ | ||
slide: { | ||
opacity: 0.2 | ||
}, | ||
selectedSlide: { | ||
opacity: 1 | ||
} | ||
}} | ||
> | ||
... | ||
</Carousel> | ||
``` | ||
#### transition | ||
@@ -142,0 +162,0 @@ `React.PropTypes.oneOf(['fade', 'slide'])` |
@@ -55,3 +55,4 @@ import React, { PropTypes, Component, Children, cloneElement } from 'react'; | ||
track: PropTypes.object, | ||
slide: PropTypes.object | ||
slide: PropTypes.object, | ||
selectedSlide: PropTypes.object | ||
}) | ||
@@ -456,7 +457,7 @@ }; | ||
); | ||
const slideStyle = merge({}, style.slide || {}, { | ||
let slideStyle = { | ||
marginLeft: `${cellPadding}px`, | ||
height: slideHeight, | ||
width: slideWidth | ||
}); | ||
}; | ||
@@ -477,2 +478,4 @@ if (transition === 'fade') { | ||
slideStyle = merge({}, slideStyle, style.slide || {}, index === currentSlide ? style.selectedSlide || {} : {}); | ||
const loadingSlideStyle = { | ||
@@ -479,0 +482,0 @@ marginLeft: slideStyle.marginLeft, |
@@ -18,3 +18,3 @@ import React from 'react'; | ||
} | ||
} | ||
}; | ||
@@ -286,2 +286,5 @@ describe('Carousel', () => { | ||
opacity: 0.9 | ||
}, | ||
selectedSlide: { | ||
opacity: 1 | ||
} | ||
@@ -307,3 +310,5 @@ }; | ||
expect(slide.style.opacity).to.equal('0.9'); | ||
const selectedSlide = document.querySelector('.carousel-slide-selected'); | ||
expect(selectedSlide.style.opacity).to.equal('1'); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102539
2492
216