diff --git a/client/scripts/index.js b/client/scripts/index.js index 71b3ce82..fbadfbc8 100755 --- a/client/scripts/index.js +++ b/client/scripts/index.js @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ "use strict"; require("../styles/index.scss"); var React = require("react/addons"); @@ -14,20 +13,20 @@ function geometryToComponentWithLatLng (geometry) { switch (type) { case "Polygon": return { - Component: Polygon, + ElementClass: Polygon, paths: coordinates.map(geometryToComponentWithLatLng, {type: "LineString"})[0] }; case "LineString": coordinates = coordinates.map(geometryToComponentWithLatLng, {type: "Point"}); return typeFromThis ? coordinates : { - Component: Polyline, + ElementClass: Polyline, path: coordinates }; case "Point": coordinates = new google.maps.LatLng(coordinates[1], coordinates[0]); return typeFromThis ? coordinates : { - Component: Marker, - ChildComponent: InfoWindow, + ElementClass: Marker, + ChildElementClass: InfoWindow, position: coordinates }; default: @@ -149,53 +148,37 @@ var Body = React.createClass({ _render (props, state) { var {geoStateBy} = state; - var components = state.geoJson.features.map((feature) => { + var elements = state.geoJson.features.map((feature) => { var {properties} = feature; var result = geometryToComponentWithLatLng(feature.geometry); - var Component = result.Component; - delete result.Component; + var ElementClass = result.ElementClass; + delete result.ElementClass; if (properties.isCenter) { - Component = Map; + ElementClass = Map; result.center = result.position; delete result.position; } - var geoStatesOfFeature = geoStateBy[feature.id] || {}; - if (geoStatesOfFeature.visible === false) { + var {visible, child, ...geoStatesOfFeature} = geoStateBy[feature.id] || {}; + if (false === visible) { return null; } - var {style} = properties; - if (style) { - style = update(properties.style, { - $merge: result - }); - } else { - style = result; - } - if (geoStatesOfFeature) { - style = update(style, { - $merge: geoStatesOfFeature - }); - } - if (style.child) { - var {ChildComponent} = result; - delete result.ChildComponent; - return Component(style, ChildComponent(style.child)); - } - return Component(style); + return + {child ? : null} + ; }); return React.DOM.div({ style: { height: "100%" } - }, components); + }, elements); } }); -var bodyRef = React.renderComponent( +var bodyComponent = React.render( , document.getElementById("react-root") ); diff --git a/package.json b/package.json index b7e8e5b9..c1cc02cb 100644 --- a/package.json +++ b/package.json @@ -54,8 +54,8 @@ "html-webpack-plugin": "^1.1.0", "jest-cli": "^0.1.18", "jquery": "^2.1.1", - "jsx-loader": "^0.11.2", - "react-tools": "^0.11.2", + "jsx-loader": "^0.12.0", + "react-tools": "^0.12.0", "sass-loader": "^0.3.0", "style-loader": "^0.8.1", "tomchentw-npm-dev": "^1.1.0", @@ -63,7 +63,7 @@ "webpack-dev-server": "^1.6.5" }, "dependencies": { - "react": "^0.11.0", + "react": "^0.12.0", "deep-equal": "^0.2.1" }, "jest": { diff --git a/src/GoogleMapsMixin.js b/src/GoogleMapsMixin.js index 7e9ab199..0aed9f74 100644 --- a/src/GoogleMapsMixin.js +++ b/src/GoogleMapsMixin.js @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ "use strict"; var React = require("react/addons"); diff --git a/src/InfoWindow.js b/src/InfoWindow.js index cc333934..d117ec3c 100644 --- a/src/InfoWindow.js +++ b/src/InfoWindow.js @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ "use strict"; var React = require("react/addons"); diff --git a/src/Map.js b/src/Map.js index b4158ab0..bc7da54c 100644 --- a/src/Map.js +++ b/src/Map.js @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ "use strict"; var React = require("react/addons"); diff --git a/src/Marker.js b/src/Marker.js index 3ef42ef5..f9f382f6 100644 --- a/src/Marker.js +++ b/src/Marker.js @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ "use strict"; var React = require("react/addons"); diff --git a/src/Polygon.js b/src/Polygon.js index 32d28e14..d4dca617 100644 --- a/src/Polygon.js +++ b/src/Polygon.js @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ "use strict"; var React = require("react/addons"); diff --git a/src/Polyline.js b/src/Polyline.js index 201fca7a..49550e02 100644 --- a/src/Polyline.js +++ b/src/Polyline.js @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ "use strict"; var React = require("react/addons"); diff --git a/src/__tests__/Map-test.js b/src/__tests__/Map-test.js index e049585f..0c591099 100644 --- a/src/__tests__/Map-test.js +++ b/src/__tests__/Map-test.js @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ "use strict"; jest.dontMock("../Map.js"); diff --git a/src/__tests__/index-test.js b/src/__tests__/index-test.js index 908352f4..838e9c74 100644 --- a/src/__tests__/index-test.js +++ b/src/__tests__/index-test.js @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ "use strict"; jest.dontMock("../index.js"); diff --git a/src/index.js b/src/index.js index 01b5e9d8..ddc2f433 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ "use strict"; exports.GoogleMapsMixin = require("./GoogleMapsMixin"); exports.Map = require("./Map"); diff --git a/src/mixins/ChildMixin.js b/src/mixins/ChildMixin.js index 8401f782..ba99051f 100644 --- a/src/mixins/ChildMixin.js +++ b/src/mixins/ChildMixin.js @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ "use strict"; var React = require("react/addons"); var deepEqual = require("deep-equal"); diff --git a/src/mixins/EventBindingMixin.js b/src/mixins/EventBindingMixin.js index 39f73675..61dfc7ca 100644 --- a/src/mixins/EventBindingMixin.js +++ b/src/mixins/EventBindingMixin.js @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ "use strict"; module.exports = {