Created
September 25, 2017 00:34
-
-
Save lizdenhup/bbded8b7656e918e54d7607461b20efd to your computer and use it in GitHub Desktop.
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
import React, { Component } from 'react'; | |
import Candidate from './Candidate.js'; | |
import Button from 'react-uikit-button'; | |
export default class CandidateList extends Component { | |
constructor(props) { | |
super(props); | |
this.handleClick = this.handleClick.bind(this) | |
} | |
handleClick() { | |
this.props.onClick(this.props.votes) | |
} | |
render() { | |
if (this.props.candidates !== null) { | |
var candidateItems = this.props.candidates.map((candidate) => ( | |
<Candidate | |
key={'candidate-' + candidate.id} | |
id={candidate.id} | |
name={candidatecandidate[0]} | |
/> | |
)); | |
return ( | |
<div> | |
{candidateItems} | |
<Button | |
block body='Vote for me!' | |
context='primary' | |
onClick={this.handleClick} /> | |
</div> | |
)} else { | |
return ( | |
null | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment