You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.0 KiB
42 lines
1.0 KiB
require('../../sass/board/board.scss');
|
|
|
|
import { Component } from 'react';
|
|
import { connect } from 'react-redux';
|
|
|
|
import Scorebar from './scorebar.component';
|
|
import Titlebar from './titlebar.component';
|
|
import Grid from './grid.component';
|
|
import Message from './message.component';
|
|
import Muncher from './muncher.component';
|
|
import Troggles from './troggles.component';
|
|
|
|
import BoardCtrl from '../../controllers/board.controller';
|
|
|
|
let listener;
|
|
|
|
export class Board extends Component {
|
|
componentDidMount() {
|
|
BoardCtrl.setDispatch(this.props.dispatch);
|
|
BoardCtrl.nextLevel();
|
|
|
|
listener = BoardCtrl.keyListener.bind(BoardCtrl);
|
|
window.addEventListener('keydown', listener);
|
|
};
|
|
|
|
componentWillUnmount() {
|
|
window.removeEventListener('keydown', listener);
|
|
};
|
|
|
|
render() {
|
|
return (<div className='board'>
|
|
<Scorebar />
|
|
<Muncher />
|
|
<Message />
|
|
<Titlebar />
|
|
<Grid />
|
|
<Troggles />
|
|
</div>);
|
|
};
|
|
};
|
|
|
|
export default connect()(Board)
|
|
|