mirror of
https://github.com/TrentSPalmer/fcc-challenges.git
synced 2025-08-23 18:23:58 -07:00
add drum-machine-react
This commit is contained in:
36
drum-machine-react/src/SelectVolume.js
Normal file
36
drum-machine-react/src/SelectVolume.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import React from 'react';
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import './Selection.css';
|
||||
|
||||
import { setDrumPadGridAction } from "./actions/setDrumPadGridAction";
|
||||
import { setSelectionMenuAction } from "./actions/setSelectionMenuAction";
|
||||
|
||||
const mapStateToProps = (state) => ({ ...state });
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setDrumPadGridAction: (drumPadGrid) => dispatch(setDrumPadGridAction(drumPadGrid)),
|
||||
setSelectionMenuAction: (selectionMenu) => dispatch(setSelectionMenuAction(selectionMenu)),
|
||||
});
|
||||
|
||||
class SelectVolume extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
};
|
||||
|
||||
handleClick() {
|
||||
this.props.setSelectionMenuAction('pads');
|
||||
this.props.setDrumPadGridAction('volumeSelectionMenu');
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div id="select-volume" className="selection" onClick={this.handleClick}>
|
||||
<p>select<br/>a volume</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(SelectVolume);
|
Reference in New Issue
Block a user