diff --git a/packages/my-joyent/src/components/packages/list.js b/packages/my-joyent/src/components/packages/list.js index 53fba0e0..b0e06af7 100644 --- a/packages/my-joyent/src/components/packages/list.js +++ b/packages/my-joyent/src/components/packages/list.js @@ -27,9 +27,9 @@ class Packages extends Component { this.handleClick = this.handleClick.bind(this); } - handleClick(i) { + handleClick(id) { this.setState({ - selected: i + selected: id }); } render() { @@ -39,12 +39,12 @@ class Packages extends Component { return ( {packages.length > 0 ? ( - packages.map((pack, i) => ( - + packages.map(pack => ( + this.handleClick(i)} - selected={selected === i} + onClick={() => this.handleClick(pack.id)} + selected={selected === pack.id} /> )) diff --git a/packages/my-joyent/src/data/packages.json b/packages/my-joyent/src/data/packages.json index ab79dc18..93a67f87 100644 --- a/packages/my-joyent/src/data/packages.json +++ b/packages/my-joyent/src/data/packages.json @@ -1,5 +1,6 @@ [ { + "id": 1, "name": "High CPU 0.25", "vcpus": 0.25, "memory": 0.256, @@ -8,6 +9,7 @@ "price": "0.016" }, { + "id": 2, "name": "High CPU 0.75", "vcpus": 0.5, "memory": 0.768, @@ -16,6 +18,7 @@ "price": "0.033" }, { + "id": 3, "name": "High CPU 1.75", "vcpus": 1, "memory": 1.8, @@ -24,6 +27,7 @@ "price": "0.066" }, { + "id": 4, "name": "High CPU 3.75", "vcpus": 2, "memory": 3.8, @@ -32,6 +36,7 @@ "price": "0.131" }, { + "id": 5, "name": "High CPU 7.75", "vcpus": 4, "memory": 7.8, @@ -40,6 +45,7 @@ "price": "0.263" }, { + "id": 6, "name": "High CPU 15.75", "vcpus": 8, "memory": 15.8, @@ -48,6 +54,7 @@ "price": "0.525" }, { + "id": 7, "name": "General 3.75", "vcpus": 1, "memory": 3.8, @@ -56,6 +63,7 @@ "price": "0.084" }, { + "id": 8, "name": "General 7.75", "vcpus": 2, "memory": 7.8, @@ -64,6 +72,7 @@ "price": "0.166" }, { + "id": 9, "name": "General 15.75", "vcpus": 4, "memory": 15.8, @@ -72,6 +81,7 @@ "price": "0.333" }, { + "id": 10, "name": "General 31.75", "vcpus": 8, "memory": 31.8, @@ -80,6 +90,7 @@ "price": "0.665" }, { + "id": 11, "name": "High RAM 15.75", "vcpus": 2, "memory": 15.8, @@ -88,6 +99,7 @@ "price": "0.259" }, { + "id": 12, "name": "High RAM 31.75", "vcpus": 4, "memory": 31.8, @@ -96,6 +108,7 @@ "price": "0.52" }, { + "id": 13, "name": "High RAM 63.75", "vcpus": 8, "memory": 63.8, @@ -104,6 +117,7 @@ "price": "1.039" }, { + "id": 14, "name": "Fast Disk 31.75", "vcpus": 4, "memory": 31.8, @@ -112,6 +126,7 @@ "price": "1.066" }, { + "id": 15, "name": "Fast Disk 63.75", "vcpus": 8, "memory": 63.8, @@ -120,6 +135,7 @@ "price": "2.31" }, { + "id": 16, "name": "Big Disk 15.75", "vcpus": 2, "memory": 15.8, @@ -128,6 +144,7 @@ "price": "0.413" }, { + "id": 17, "name": "Big Disk 31.75", "vcpus": 4, "memory": 31.8, @@ -136,6 +153,7 @@ "price": "0.825" }, { + "id": 18, "name": "Big Disk 63.75", "vcpus": 8, "memory": 63.8,