Game mode and new game blink states finished.

master
Ben Burlingham 9 years ago
parent 3194cb8728
commit 8e1e1680e3
  1. 5
      App.js
  2. 16
      components/welcome/new-game.component.js
  3. 18
      reducers/welcome/new-game.reducer.js

@ -14,14 +14,13 @@ export const SETTINGS = {
export default class App extends Component { export default class App extends Component {
render() { render() {
const { mode, dispatch } = this.props; const { mode } = this.props;
console.log(dispatch)
switch (this.props.mode) { switch (this.props.mode) {
case ModeActions.WELCOME: case ModeActions.WELCOME:
return <Welcome />; return <Welcome />;
case ModeActions.BOARD: case ModeActions.BOARD:
return <Board dispatch={this.props.dispatch} />; return <Board />;
} }
}; };
}; };

@ -17,7 +17,7 @@ export default class NewGame extends Component {
componentDidMount() { componentDidMount() {
newgameListener = this.handleKeydown.bind(this); newgameListener = this.handleKeydown.bind(this);
window.addEventListener('keydown', newgameListener); window.addEventListener('keydown', newgameListener);
// toggleTimeout.call(this); toggleTimeout.call(this);
}; };
componentWillUnmount() { componentWillUnmount() {
@ -34,7 +34,7 @@ export default class NewGame extends Component {
render() { render() {
const classname = ['newgame']; const classname = ['newgame'];
if (this.props.blink === true) { if (this.props.hidden === true) {
classname.push('hidden'); classname.push('hidden');
} }
@ -43,9 +43,9 @@ export default class NewGame extends Component {
); );
}; };
}; };
//
// const select = (state) => { const select = (state) => {
// return state.newgame; return state.newgame;
// }; };
//
// export default connect(select)(NewGame); export default connect(select)(NewGame);

@ -1,16 +1,16 @@
require('immutable'); require('immutable');
import * as NewGameActions from '../../actions/welcome/new-game.actions'; import * as NewGameActions from '../../actions/welcome/new-game.actions';
const reducer = (state = false, action) => { const reducer = (state = { hidden: false }, action) => {
// if (action.type !== NewGameActions.NEWGAME_ACTION) { if (action.type !== NewGameActions.NEWGAME_ACTION) {
// return state; return state;
// } }
//
// if (action.action === NewGameActions.BLINK) {
// return (state ? false : true);
// }
return false; if (action.action === NewGameActions.BLINK) {
return (state.hidden ? { hidden: false } : { hidden: true });
}
return state;
}; };
export default reducer; export default reducer;

Loading…
Cancel
Save