|
@@ -1,6 +1,7 @@
|
|
|
import React, { Component } from "react";
|
|
|
|
|
|
import Form from "../components/form";
|
|
|
+import HOCcomponent from "../components/HOC/resize";
|
|
|
|
|
|
const list = [
|
|
|
{
|
|
@@ -13,7 +14,7 @@ const list = [
|
|
|
}
|
|
|
];
|
|
|
|
|
|
-export default class Main extends Component {
|
|
|
+class Main extends Component {
|
|
|
state = {
|
|
|
list: list,
|
|
|
newItem: {
|
|
@@ -42,27 +43,35 @@ export default class Main extends Component {
|
|
|
render() {
|
|
|
const { list } = this.state;
|
|
|
|
|
|
- console.log("aaaa", this.state.newItem);
|
|
|
return (
|
|
|
- <div className="box">
|
|
|
- <div className="list">
|
|
|
- {list.map(el => (
|
|
|
- <div className="list__item" key={el.id}>
|
|
|
- <h4 className="list__item-title">{el.firstName}</h4>
|
|
|
- <p className="list__item-age">Age: {el.age}</p>
|
|
|
- <ul className="list__item-ul">
|
|
|
- {el.hobby.map(elem => (
|
|
|
- <li className="list__item-li" key={elem}>
|
|
|
- {elem}
|
|
|
- </li>
|
|
|
- ))}
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
- ))}
|
|
|
+ <>
|
|
|
+ <div style={{ border: "1px solid #eee", textAlign: "center", padding: 10 }}>
|
|
|
+ Now your screen size:
|
|
|
+ <p>W = {this.props.w}</p>
|
|
|
+ <p>H = {this.props.h}</p>
|
|
|
</div>
|
|
|
+ <div className="box">
|
|
|
+ <div className="list">
|
|
|
+ {list.map(el => (
|
|
|
+ <div className="list__item" key={el.id}>
|
|
|
+ <h4 className="list__item-title">{el.firstName}</h4>
|
|
|
+ <p className="list__item-age">Age: {el.age}</p>
|
|
|
+ <ul className="list__item-ul">
|
|
|
+ {el.hobby.map(elem => (
|
|
|
+ <li className="list__item-li" key={elem}>
|
|
|
+ {elem}
|
|
|
+ </li>
|
|
|
+ ))}
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
|
|
|
- <Form onChangeEvent={this.onChange} onSubmitEvent={this.onSubmit} values={this.state.newItem} />
|
|
|
- </div>
|
|
|
+ <Form onChangeEvent={this.onChange} onSubmitEvent={this.onSubmit} values={this.state.newItem} />
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+export default HOCcomponent(Main);
|