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 {
render() {
const { mode, dispatch } = this.props;
console.log(dispatch)
const { mode } = this.props;
switch (this.props.mode) {
case ModeActions.WELCOME:
return <Welcome />;
case ModeActions.BOARD:
return <Board dispatch={this.props.dispatch} />;
return <Board />;
}
};
};

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

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

Loading…
Cancel
Save