ESPTrainer built with Meteor and React

BoardLayout.jsx 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React, { PropTypes } from 'react';
  2. import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
  3. import Square from './Square';
  4. import Trials from './Trials';
  5. import Actions from './Actions';
  6. import Image from './Image';
  7. import Score from './Score';
  8. import ScoreChart from './ScoreChart';
  9. import './styles/Board';
  10. const BoardLayout = ({ active, win, actions, trials, score, scores, image, choices, highlighted }) =>
  11. <div className="board">
  12. <Score score={score} />
  13. <div className="squares">
  14. <div className="row">
  15. <Square color="green" click={choices[0]} highlighted={highlighted[0]} active={active} />
  16. <Square color="yellow" click={choices[1]} highlighted={highlighted[1]} active={active} />
  17. </div>
  18. <div className="row">
  19. <Square color="red" click={choices[2]} highlighted={highlighted[2]} active={active} />
  20. <Square color="blue" click={choices[3]} highlighted={highlighted[3]} active={active} />
  21. </div>
  22. <ReactCSSTransitionGroup transitionName="appear" transitionEnterTimeout={500} transitionLeaveTimeout={500} >
  23. { win ? <Image src={image}/> : null }
  24. </ReactCSSTransitionGroup>
  25. </div>
  26. <Trials count={trials} />
  27. <Actions actions={actions} />
  28. <ScoreChart id="scoreChart" data={scores}/>
  29. </div>;
  30. BoardLayout.propTypes = {
  31. active: PropTypes.bool,
  32. win: PropTypes.bool.isRequired,
  33. actions: Actions.propTypes.actions,
  34. trials: Trials.propTypes.count,
  35. score: Trials.propTypes.count,
  36. scores: Chart.propTypes.data,
  37. image: Image.propTypes.src,
  38. choices: PropTypes.arrayOf(PropTypes.func).isRequired,
  39. highlighted: PropTypes.arrayOf(PropTypes.bool).isRequired
  40. };
  41. export default BoardLayout;