A wrapper around nuka-carousel
for displaying products at nib.
npm install @nib-components/react-product-carousel
import React from 'react';
import ReactDOM from 'react-dom';
import ProductCarousel from '@nib-components/react-product-carousel';
const onBeforeSlide = (currentSlide) => {
console.log('before');
console.log(currentSlide);
};
const onAfterSlide = (currentSlide) => {
console.log('after');
console.log(currentSlide);
};
ReactDOM.render(
<ProductCarousel prompt="Here is a message" onBeforeSlide={onBeforeSlide} onAfterSlide={onAfterSlide}>
<div className="product"/>
<div className="product"/>
<div className="product"/>
</ProductCarousel>,
document.querySelector('#app')
);
Can add a custom className.
#Props
Default value for prompt is 'Swipe to view our products'
function is called after slide with the number of the current slide
function is called before slide with the number of the previous slide
bool
. Hide arrows and disable swipe on desktop. Defaults true.
number
. Either 750
or 1000
. To be used in conjunction with hideControls
. If hideControls={true}
, defaults to 750.
bool
. Show grey boxes at the start and end of the carousel. Defaults false.
- Additional
hideControlsAt
prop to choose at which point to disable carousel functionality
- Sticky carousel arrows
- Editable
ghostProducts
- Breaking change in
v2-icons
- Add:
hideControls
andghostProducts
flags
- Bump version of
sass-grid
to major version.
- Fix: Reduce z-index of arrows
- Bump to major version for npm
<1.0.0
fix
- Feature: Added onBeforeSlide and onAfterSlide hooks.
- new props: Optional 'onBeforeSlide', Optional 'onAfterSlide'.
- Feature: You can now add a custom prompt with a new 'prompt' attribute added to the Product Carousel tag
- new prop: 'prompt'
- fix: Just include the v2-icons mixins, not the full css.
##To Do
- More Doco
- Tests