Created
May 9, 2017 14:56
-
-
Save codequistador/44a7961a7f9994c6b1cce31d4271343e to your computer and use it in GitHub Desktop.
Starting Samer's game
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Stars = (props) => { | |
| const numberOfStars = 1 + Math.floor(Math.random()*9); | |
| return ( | |
| <div className="col-5"> | |
| {_.range(numberOfStars).map(i => | |
| <i key={i} className="fa fa-star"></i> | |
| )} | |
| </div> | |
| ) | |
| } | |
| const Button = (props) => { | |
| return ( | |
| <div className="col-2"> | |
| <button>=</button> | |
| </div> | |
| ) | |
| } | |
| const Answer = (props) => { | |
| return ( | |
| <div className="col-2"> | |
| <span>5</span> | |
| </div> | |
| ) | |
| } | |
| const Numbers = (props) => { | |
| return ( | |
| <div className="card text-center"> | |
| <div> | |
| {Numbers.list.map((number, i) => | |
| <span key={i}>{number}</span> | |
| )} | |
| </div> | |
| </div> | |
| ) | |
| }; | |
| Numbers.list = _.range(1, 10); | |
| class Game extends React.Component { | |
| render() { | |
| return ( | |
| <div className="container"> | |
| <h3>Play Nine</h3> | |
| <hr /> | |
| <div className="row"> | |
| <Stars /> | |
| <Button /> | |
| <Answer /> | |
| </div> | |
| <br /> | |
| <Numbers /> | |
| </div> | |
| ); | |
| } | |
| } | |
| class App extends React.Component { | |
| render() { | |
| return ( | |
| <div> | |
| <Game /> | |
| </div> | |
| ); | |
| } | |
| } | |
| ReactDOM.render(<App />, mountNode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment