Created
          October 9, 2018 00:28 
        
      - 
      
- 
        Save rcdexta/d32f9c2e81199ca58990517899d3a2ef to your computer and use it in GitHub Desktop. 
    TodoListItem
  
        
  
    
      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
    
  
  
    
  | class TodoListItem extends React.Component { | |
| static propTypes = { | |
| item: PropTypes.object, | |
| removeItem: PropTypes.func, | |
| markTodoDone: PropTypes.func | |
| } | |
| onClickClose = () => { | |
| const {index, removeItem} = this.props; | |
| removeItem(index); | |
| }; | |
| onClickDone = () => { | |
| const {index, markTodoDone} = this.props; | |
| markTodoDone(index); | |
| }; | |
| render() { | |
| const {item} = this.props; | |
| const todoClass = item.done ? "done" : "undone"; | |
| return ( | |
| <tr data-testid={`todoItem${item.index}`}> | |
| <td className={todoClass}> | |
| <span data-testid="markAsCompleted" className="glyphicon glyphicon-ok icon" aria-hidden="true" onClick={this.onClickDone}/> | |
| {item.value} | |
| <span data-testid="markAsDeleted"className="glyphicon glyphicon-remove-sign close" aria-hidden="true" onClick={this.onClickClose}/> | |
| </td> | |
| </tr> | |
| ); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment