Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cff891
commit f0977a4
Showing
4 changed files
with
86 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,35 @@ | ||
var React = require("react"); | ||
var React = require('react'); | ||
var PropTypes = React.PropTypes; | ||
var ReactRouter = require('react-router'); | ||
var Link = ReactRouter.Link; | ||
var UserDetails = require('./UserDetails'); | ||
|
||
function Battle(props){ | ||
return props.isLoading === true ? <p> Loading </p> : <p> Battle Muthafucka </p> | ||
function ConfirmBattle (props) { | ||
return props.isLoading === true | ||
? <p>LOADING</p> | ||
: <div className="jumbotron col-sm-12 text-center" > | ||
<h1>Confirm Players</h1> | ||
<div className='col-sm-8 col-sm-offset-2'> | ||
<UserDetails info={props.playersInfo[0]} /> | ||
<UserDetails info={props.playersInfo[1]} /> | ||
</div> | ||
<div className='col-sm-8 col-sm-offset-2'> | ||
<div className='col-sm-12'> | ||
<button type='button' className='btn btn-lg btn-success' onClick={props.onInitiateBattle}>Initiate Battle!</button> | ||
</div> | ||
<div className='col-sm-12'> | ||
<Link to='/playerOne'> | ||
<button type='button' className='btn btn-lg btn-danger'>Reselect Players</button> | ||
</Link> | ||
</div> | ||
</div> | ||
</div> | ||
} | ||
|
||
module.exports = Battle; | ||
ConfirmBattle.propTypes = { | ||
isLoading: PropTypes.bool.isRequired, | ||
onInitiateBattle: PropTypes.func.isRequired, | ||
playersInfo: PropTypes.array.isRequired, | ||
} | ||
|
||
module.exports = ConfirmBattle; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
var React = require('react'); | ||
var PropTypes = React.PropTypes | ||
|
||
function UserDetails (user) { | ||
return ( | ||
<div> | ||
{!!user.score && <li className="list-group-item"><h3>Score: {user.score}</h3></li>} | ||
<li className="list-group-item"> <img src={user.info.avatar_url} className="img-rounded img-responsive"/></li> | ||
{user.info.name && <li className="list-group-item">Name: {user.info.name}</li>} | ||
<li className="list-group-item">Username: {user.info.login}</li> | ||
{user.info.location && <li className="list-group-item">Location: {user.info.location}</li>} | ||
{user.info.company && <li className="list-group-item">Company: {user.info.company}</li>} | ||
<li className="list-group-item">Followers: {user.info.followers}</li> | ||
<li className="list-group-item">Following: {user.info.following}</li> | ||
<li className="list-group-item">Public Repos: {user.info.public_repos}</li> | ||
{user.info.blog && <li className="list-group-item">Blog: <a href={user.info.blog}> {user.info.blog}</a></li>} | ||
</div> | ||
) | ||
} | ||
|
||
UserDetails.propTypes = { | ||
score: PropTypes.number, | ||
info: PropTypes.shape({ | ||
avatar_url: PropTypes.string.isRequired, | ||
blog: PropTypes.string, | ||
company: PropTypes.string, | ||
followers: PropTypes.number.isRequired, | ||
following: PropTypes.number.isRequired, | ||
location: PropTypes.string, | ||
login: PropTypes.string.isRequired, | ||
name: PropTypes.string, | ||
public_repos: PropTypes.number.isRequired, | ||
}) | ||
} | ||
|
||
module.exports = UserDetails; |
This file contains 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
This file contains 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