ESPTrainer built with Meteor and React

BoardLayout.jsx 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 './styles/Board';
  9. const BoardLayout = ({ active, win, actions, trials, score, image, choices, highlighted }) =>
  10. <div className="board">
  11. <Score score={score} />
  12. <div className="squares">
  13. <div className="row">
  14. <Square color="green" click={choices[0]} highlighted={highlighted[0]} active={active} />
  15. <Square color="yellow" click={choices[1]} highlighted={highlighted[1]} active={active} />
  16. </div>
  17. <div className="row">
  18. <Square color="red" click={choices[2]} highlighted={highlighted[2]} active={active} />
  19. <Square color="blue" click={choices[3]} highlighted={highlighted[3]} active={active} />
  20. </div>
  21. <ReactCSSTransitionGroup transitionName="appear" transitionEnterTimeout={500} transitionLeaveTimeout={500} >
  22. { win ? <Image src={image}/> : null }
  23. </ReactCSSTransitionGroup>
  24. </div>
  25. <Trials count={trials} />
  26. <Actions actions={actions} />
  27. </div>;
  28. BoardLayout.propTypes = {
  29. active: PropTypes.bool,
  30. win: PropTypes.bool.isRequired,
  31. actions: Actions.propTypes.actions,
  32. trials: Trials.propTypes.count,
  33. score: Trials.propTypes.count,
  34. image: Image.propTypes.src,
  35. choices: PropTypes.arrayOf(PropTypes.func).isRequired,
  36. highlighted: PropTypes.arrayOf(PropTypes.bool).isRequired
  37. };
  38. export default BoardLayout;