-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
56 lines (50 loc) · 1.31 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import LaneList from './components/lane-list';
import { laneListSelector } from './selectors/selectors';
import { addLane, deleteLane, moveNote } from './action/lane-action';
class Todo extends Component {
handleAddLane = () => {
this.props.addLane('New Lane');
};
handleDeleteLane = (id) => {
this.props.deleteLane([id]);
};
renderComponent = (props) => {
const { laneList } = props;
return (
<div className="kanban-app">
<button className="add-lane" onClick={this.handleAddLane}>+</button>
<LaneList
className="lane-list"
laneList={laneList}
onDeleteLane={(id) => this.handleDeleteLane(id)}
/>
</div>
);
};
render() {
return this.renderComponent(this.props, this.state);
}
}
export default connect(
(state, props) => {
return {
laneList: laneListSelector(state, props),
};
},
(dispatch) => {
return bindActionCreators({
addLane,
deleteLane,
moveNote,
}, dispatch);
},
)(Todo);
Todo.propTypes = {
addLane: PropTypes.func.isRequired,
deleteLane: PropTypes.func.isRequired,
laneList: PropTypes.array.isRequired,
};