40 | {
41 | slides.map(function(slide, i) {
42 | return
;
43 | }.bind(this))
44 | }
45 |
46 |
47 | );
48 | },
49 |
50 | handleClick: function() {
51 | this.setState({currentIndex: this.state.currentIndex + 1});
52 | }
53 | });
54 | ```
55 |
56 | ## API
57 |
58 | ### Props
59 |
60 | ##### classNamespace
61 |
62 | Namespace for CSS classes, _optional_, default is `` i.e CSS classes are `'' + 'pacman'`.
63 |
64 | ##### items
65 |
66 | Number of dots for pacman to eat. _required_
67 |
68 | ##### currentIndex
69 |
70 | Position of the pacman. Start at 0. _required_
71 |
72 | ##### onClick
73 |
74 | Function to call when clicking on a dot. _optional_, it takes 3 arguments:
75 | * index of the dot clicked
76 | * whether it was pacman which was clicked or not
77 | * the event
78 |
79 | ```
80 | handleClickPacman(index, isPacman, e) {
81 | e.preventDefault();
82 | this.setState({currentIndex: index});
83 | }
84 | ```
85 |
86 | ## Styles
87 |
88 | Look at [react-pacman-progress.css](https://github.com/mathieudutour/react-pacman-progress/blob/master/react-pacman-progress.css) for an idea on how to style this component.
89 |
90 | ---
91 |
92 | MIT Licensed
93 |
--------------------------------------------------------------------------------
/example/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |