|
1 | 1 | import React from 'react'; |
2 | | -import {connect} from 'react-redux'; |
| 2 | +import { connect } from 'react-redux'; |
3 | 3 | import Editable from './Editable.jsx'; |
4 | 4 | import Note from './Note.jsx'; |
5 | | -import {move} from '../actions/lanes'; |
| 5 | +import { move } from '../actions/lanes'; |
6 | 6 |
|
7 | | -class Notes extends React.Component { |
8 | | - render() { |
9 | | - const {notes, move, onValueClick, onEdit, onDelete} = this.props; |
| 7 | +const Notes = ({ |
| 8 | + notes, move, onValueClick, onEdit, onDelete |
| 9 | +}) => ( |
| 10 | + <ul className="notes">{notes.map((note) => { |
| 11 | + const noteId = note.get('id'); |
10 | 12 |
|
11 | | - return (<ul className="notes">{notes.map((note) => |
12 | | - <Note className="note" id={note.get('id')} key={note.get('id')} |
13 | | - editing={note.get('editing')} onMove={move}> |
| 13 | + return ( |
| 14 | + <Note className="note" id={noteId} key={noteId} |
| 15 | + editing={note.editing} onMove={move}> |
14 | 16 | <Editable |
15 | 17 | editing={note.get('editing')} |
16 | 18 | value={note.get('task')} |
17 | | - onValueClick={onValueClick.bind(null, note.get('id'))} |
18 | | - onEdit={onEdit.bind(null, note.get('id'))} |
19 | | - onDelete={onDelete.bind(null, note.get('id'))} /> |
| 19 | + onValueClick={onValueClick.bind(null, noteId)} |
| 20 | + onEdit={onEdit.bind(null, noteId)} |
| 21 | + onDelete={onDelete.bind(null, noteId)} /> |
20 | 22 | </Note> |
21 | | - )}</ul>); |
22 | | - } |
23 | | -} |
| 23 | + ); |
| 24 | + })}</ul> |
| 25 | +); |
24 | 26 |
|
25 | 27 | export default connect(() => ({}), { |
26 | 28 | move |
|
0 commit comments