| author | Alexandre Segura <mex.zktk@gmail.com> |
| Tue, 23 May 2017 16:18:34 +0200 | |
| changeset 5 | 5c91bfa8fcde |
| parent 3 | 3b5d37d84cfe |
| permissions | -rw-r--r-- |
| 1 | 1 |
import React, { Component } from 'react'; |
2 |
import {connect} from 'react-redux'; |
|
3 |
import {bindActionCreators} from 'redux'; |
|
4 |
||
5 |
import PropTypes from 'prop-types'; |
|
6 |
import Immutable from 'immutable'; |
|
7 |
||
| 2 | 8 |
import { Grid, Row, Col} from 'react-bootstrap'; |
9 |
||
|
3
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
10 |
import * as notesActions from '../actions/notesActions'; |
| 1 | 11 |
import NotesList from './NotesList'; |
12 |
import NoteInput from './NoteInput'; |
|
13 |
||
14 |
class NotesContainer extends Component { |
|
15 |
render() { |
|
16 |
const { notes } = this.props; |
|
17 |
return ( |
|
| 2 | 18 |
<Grid> |
19 |
<Row> |
|
20 |
<Col xs={12} md={12}> |
|
| 1 | 21 |
<NotesList notes={notes} /> |
| 2 | 22 |
</Col> |
23 |
</Row> |
|
24 |
<Row> |
|
25 |
<Col xs={12} md={12}> |
|
| 1 | 26 |
<NoteInput addNote={this.props.actions.addNote} /> |
| 2 | 27 |
</Col> |
28 |
</Row> |
|
29 |
</Grid> |
|
| 1 | 30 |
); |
31 |
} |
|
32 |
} |
|
33 |
||
34 |
NotesContainer.propTypes = { |
|
35 |
notes: PropTypes.instanceOf(Immutable.List).isRequired, |
|
36 |
actions: PropTypes.object.isRequired |
|
37 |
} |
|
38 |
||
39 |
function mapStateToProps(state, props) { |
|
40 |
return { |
|
41 |
notes: state.get('notes') |
|
42 |
}; |
|
43 |
} |
|
44 |
||
45 |
function mapDispatchToProps(dispatch) { |
|
46 |
return { |
|
47 |
actions: bindActionCreators(notesActions, dispatch) |
|
48 |
} |
|
49 |
} |
|
50 |
||
51 |
||
52 |
export default connect(mapStateToProps, mapDispatchToProps)(NotesContainer); |