-
Notifications
You must be signed in to change notification settings - Fork 386
/
Copy pathWheel.js
30 lines (27 loc) · 923 Bytes
/
Wheel.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
import React from 'react'
import { connect } from 'react-redux'
import { moveClockwise, moveCounterClockwise } from '../state/action-creators'
export function Wheel(props) {
const style = [1,2,3,4,5,6]
return (
<div id="wrapper">
<div id="wheel">
{style.map((num,idx) => {
return (
<div key={num} className={idx === props.wheel ? 'cog active' : 'cog'} style={{ "--i": `${idx}` }}>{idx === props.wheel ? 'B' : ''}</div>
)
})}
</div>
<div id="keypad">
<button id="counterClockwiseBtn" onClick={() => props.moveCounterClockwise()}>Counter clockwise</button>
<button id="clockwiseBtn" onClick={() => props.moveClockwise()}>Clockwise</button>
</div>
</div>
)
}
const mapStateToProps = (state) => {
return {
wheel: state.wheel
}
}
export default connect(mapStateToProps,{moveClockwise,moveCounterClockwise})(Wheel)