فهرست منبع

Step 2: static version - Added search bar.

Frederic G. MARAND 9 سال پیش
والد
کامیت
6413347196
2فایلهای تغییر یافته به همراه44 افزوده شده و 2 حذف شده
  1. 1 1
      package.json
  2. 43 1
      public/scripts/thinking.js

+ 1 - 1
package.json

@@ -19,7 +19,7 @@
     "example"
   ],
   "author": "petehunt",
-  "license": "UNLICENSED",
+  "license": "proprietary",
   "bugs": {
     "url": "https://github.com/reactjs/react-tutorial/issues"
   },

+ 43 - 1
public/scripts/thinking.js

@@ -71,7 +71,49 @@ let ProductTable = React.createClass({
   }
 });
 
+let SearchBar = React.createClass({
+  name: "SearchBar",
+  componentDidMount: function () {
+    console.log("Component did mountDM", this.name);
+  },
+  getInitialState: function () {
+    console.log("Get Initial State", this.name);
+    return { data: [] };
+  },
+  render: function () {
+    return (
+      <form>
+        <input type="text" placeholder="Search..." />
+        <p>
+          <input type="checkbox" />
+          {' '}
+          Only show products in stock
+        </p>
+      </form>
+    );
+  }
+});
+
+let FilterableProductTable = React.createClass({
+  name: "FilterableProductTable",
+  componentDidMount: function () {
+    console.log("Component did mountDM", this.name);
+  },
+  getInitialState: function () {
+    console.log("Get Initial State", this.name);
+    return { data: [] };
+  },
+  render: function () {
+    return (
+      <div>
+        <SearchBar />
+        <ProductTable products={this.props.products} />
+      </div>
+    );
+  }
+});
+
 ReactDOM.render(
-  <ProductTable products={[]} />,
+  <FilterableProductTable products={[]} />,
   document.getElementById("content")
 );