TodoList/src/components/Li.js

32 lines
814 B
JavaScript
Raw Normal View History

2020-01-05 21:07:36 +00:00
import React from 'react';
import 'bootstrap/dist/css/bootstrap.css';
import './Li.css';
class Li extends React.Component {
2020-01-12 21:23:43 +00:00
setMark = () => (
this.props.isDone ? 'marked' : 'unMarked'
)
2020-01-05 21:07:36 +00:00
render(){
2020-01-12 21:23:43 +00:00
const {changeMark, id, isDone, at, todo, close} = this.props
2020-01-05 21:07:36 +00:00
return (
<div>
2020-01-12 21:23:43 +00:00
<li className={this.setMark()}>
2020-01-05 21:07:36 +00:00
<div className="form-check">
<label className="form-check-label">
2020-01-12 21:23:43 +00:00
<input className={this.setMark()} type="checkbox" onChange={changeMark.bind(this, id)} checked={isDone} />
{todo} At {at}
2020-01-05 21:07:36 +00:00
<i className="input-helper"></i>
</label>
</div>
</li>
2020-01-12 21:23:43 +00:00
<i className="material-icons dp48" onClick={close.bind(this, id)}>close</i>
2020-01-05 21:07:36 +00:00
</div>
)
}
2020-01-12 21:23:43 +00:00
2020-01-05 21:07:36 +00:00
}
export default Li