Last active
May 19, 2016 05:27
-
-
Save charlesbodman/074e783e2c53e369f1b247f965e14b90 to your computer and use it in GitHub Desktop.
Simple bullet style decorators for the nuka-carousel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const bulletDecorators = [{ | |
| component:React.createClass({ | |
| shouldComponentUpdate:function(nextProps, nextState){ | |
| return this.props.currentSlide !== nextProps.currentSlide; | |
| }, | |
| render:function(){ | |
| let props = this.props; | |
| let slideCount = props.slideCount; | |
| let buttons = []; | |
| for(let i = 0; i < slideCount; i++){ | |
| let active = props.currentSlide === i ? 'active' : ''; | |
| buttons.push(<li className={"carousel_control " + active} key={i} onClick={props.goToSlide.bind(null,i)}></li>); | |
| } | |
| return(<ul className="carousel_controls">{buttons}</ul>) | |
| } | |
| }) | |
| }]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment