|
@@ -1,67 +1,48 @@
|
|
|
import React, { Component } from "react";
|
|
|
-import { string, number, bool } from "prop-types";
|
|
|
import { bindActionCreators } from "redux";
|
|
|
import { connect } from "react-redux";
|
|
|
|
|
|
-import Page from "../components/page";
|
|
|
+import { Button, Icon } from "antd";
|
|
|
+
|
|
|
import * as actions from "../actions/todo";
|
|
|
|
|
|
class App extends Component {
|
|
|
- constructor(props) {
|
|
|
- super(props);
|
|
|
- this.state = {
|
|
|
- name: "tony",
|
|
|
- age: 26,
|
|
|
- children: false
|
|
|
- };
|
|
|
-
|
|
|
- console.log("constructor");
|
|
|
- }
|
|
|
-
|
|
|
- componentDidMount() {
|
|
|
- console.log("componentDidMount");
|
|
|
- }
|
|
|
-
|
|
|
- componentDidUpdate(prevProps, prevState, prevContext) {
|
|
|
- if (this.props.error && !prevProps.error) console.log("componentDidUpdate");
|
|
|
- }
|
|
|
-
|
|
|
- shouldComponentUpdate(nextProp, nextState, nextContext) {
|
|
|
- console.log("shouldComponentUpdate");
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- componentWillUnmount() {
|
|
|
- console.log("componentWillUnmount");
|
|
|
- }
|
|
|
-
|
|
|
- static childContextTypes = {
|
|
|
- name: string,
|
|
|
- age: number,
|
|
|
- children: bool
|
|
|
- };
|
|
|
-
|
|
|
- getChildContext() {
|
|
|
- const { name, age, children } = this.state;
|
|
|
- return {
|
|
|
- name,
|
|
|
- age,
|
|
|
- children
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
render() {
|
|
|
- console.log("render");
|
|
|
+ const { list } = this.props;
|
|
|
return (
|
|
|
- <div className="container">
|
|
|
- <Page {...this.props} />
|
|
|
+ <div className="todo">
|
|
|
+ <div className="list">
|
|
|
+ {list.map(el => (
|
|
|
+ <div key={el.id} className="list__item">
|
|
|
+ <div className="list__info">
|
|
|
+ <div className="list__address">
|
|
|
+ <span className="list__origin">{el.origin}</span>
|
|
|
+ <Icon type="arrow-right" />
|
|
|
+ <span className="list__destination">{el.destination}</span>
|
|
|
+ </div>
|
|
|
+ <div className="list__driver">
|
|
|
+ <span className="list__driver-name">Контактное лицо: {el.contactName}</span>
|
|
|
+ <span className="list__driver-night">Тип рейса: {el.night ? "Ночьной" : "Дневной"}</span>
|
|
|
+ <span className="list__driver-body">Тип кузова: {el.bodyType}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className="list__buttons">
|
|
|
+ <Button size="small" type="primary">
|
|
|
+ <Icon type="edit" />
|
|
|
+ </Button>
|
|
|
+ <Button size="small" type="danger">
|
|
|
+ <Icon type="close" />
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const mapStateToProps = state => ({
|
|
|
- inputData: state.todo.inputData,
|
|
|
list: state.todo.list
|
|
|
});
|
|
|
|