ESPTrainer built with Meteor and React

BoardLayout.jsx 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. <div className="title">Tap the correct square to see a picture</div>
  13. <Score score={score} />
  14. <div className="squares">
  15. <div className="row">
  16. <Square color="green" click={choices[0]} highlighted={highlighted[0]} active={active} />
  17. <Square color="yellow" click={choices[1]} highlighted={highlighted[1]} active={active} />
  18. </div>
  19. <div className="row">
  20. <Square color="red" click={choices[2]} highlighted={highlighted[2]} active={active} />
  21. <Square color="blue" click={choices[3]} highlighted={highlighted[3]} active={active} />
  22. </div>
  23. <ReactCSSTransitionGroup transitionName="appear" transitionEnterTimeout={500} transitionLeaveTimeout={500} >
  24. { win ? <Image src={image}/> : null }
  25. </ReactCSSTransitionGroup>
  26. </div>
  27. <Trials count={trials} />
  28. <Actions actions={actions} />
  29. <ScoreChart id="scoreChart" data={scores}/>
  30. </div>;
  31. BoardLayout.propTypes = {
  32. active: PropTypes.bool,
  33. win: PropTypes.bool.isRequired,
  34. actions: Actions.propTypes.actions,
  35. trials: Trials.propTypes.count,
  36. score: Trials.propTypes.count,
  37. scores: Chart.propTypes.data,
  38. image: Image.propTypes.src,
  39. choices: PropTypes.arrayOf(PropTypes.func).isRequired,
  40. highlighted: PropTypes.arrayOf(PropTypes.bool).isRequired
  41. };
  42. export default BoardLayout;