-
Notifications
You must be signed in to change notification settings - Fork 4
/
Step.js
37 lines (33 loc) · 866 Bytes
/
Step.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
import classNames from 'classnames';
import React from 'react';
import Tappable from 'react-tappable';
import '../css/step.css';
import StepStore from '../stores/step';
const Step = React.createClass({
displayName: 'Step',
next () {
StepStore.next();
},
prev () {
StepStore.prev();
},
render: function() {
const { currentStep, availableSteps, totalSteps } = this.props;
const nextClass = classNames({
'button': true,
'button-next': true,
'button-disabled': currentStep >= availableSteps,
'hidden': currentStep === totalSteps
});
const style = {
backgroundImage: `url('images/step-${currentStep}.jpg')`,
};
return (
<div className='step' style={style}>
<Tappable className='button button-previous' onTap={this.prev}/>
<Tappable className={nextClass} onTap={this.next}/>
</div>
);
}
});
module.exports = Step;