Created
April 4, 2019 09:18
-
-
Save barongun/d7b6353b218c8c9f72aa7a29ac2f87db 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 './App.css' | |
import { Row, Col, ListGroup, ListGroupItem, Alert, InputGroup, FormLabel, FormControl } from 'react-bootstrap' | |
class App extends Component { | |
constructor (props) { | |
super(props) | |
this.state = { | |
todos: [ | |
{title: '1', cleared: false}, | |
{title: '2', cleared: false}, | |
{title: '3', cleared: false}, | |
{title: '4', cleared: true} | |
] | |
} | |
} | |
render () { | |
const unClearTodos = this.state.todos.filter(row => row.cleared === false).map((item, key) => | |
<ListGroupItem> | |
<InputGroup> | |
<InputGroup.Checkbox/> | |
<FormLabel>{item.title}</FormLabel> | |
</InputGroup> | |
</ListGroupItem> | |
) | |
const clearedTodos = this.state.todos.filter(row => row.cleared === true).map((item, key) => | |
<ListGroupItem>{item.title}</ListGroupItem> | |
) | |
return ( | |
<div> | |
<Row> | |
<Col> | |
<Alert variant="primary">TODO</Alert> | |
<ListGroup> | |
<ListGroupItem> | |
<InputGroup> | |
<FormControl/> | |
</InputGroup> | |
</ListGroupItem> | |
{unClearTodos} | |
</ListGroup> | |
</Col> | |
<Col> | |
<Alert variant="success">FINISHED</Alert> | |
<ListGroup> | |
{clearedTodos} | |
</ListGroup> | |
</Col> | |
</Row> | |
</div> | |
) | |
} | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment