Skip to content

Commit

Permalink
docs(examples): ES7ify examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchentw committed Aug 7, 2015
1 parent 8e0483b commit a8ea37a
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 65 deletions.
20 changes: 9 additions & 11 deletions examples/gh-pages/scripts/NavHeaderBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ export default class NavHeaderBar extends Component {
rightActions: actionsArrayType,
}

constructor (props, ...restArgs) {
super({
onNavigateTo: noop,
actions: [],
dropdownActions: [],
rightActions: [],
...props,
}, ...restArgs);
this.state = {
dropdownOpen: false,
};
static defaultProps = {
onNavigateTo: noop,
actions: [],
dropdownActions: [],
rightActions: [],
}

state = {
dropdownOpen: false,
}

_handle_click () {
Expand Down
7 changes: 2 additions & 5 deletions examples/gh-pages/scripts/ReactRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,8 @@ const ALL_ACTIONS = ACTIONS.concat(DROPDOWN_ACTIONS.filter((x) => { return !!x;

export default class ReactRoot extends Component {

constructor (...args) {
super(args);
this.state = {
action: ACTIONS[0],
};
state = {
action: ACTIONS[0],
}

componentWillMount () {
Expand Down
47 changes: 22 additions & 25 deletions examples/gh-pages/scripts/components/GeojsonToComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,30 @@ function geometryToComponentWithLatLng (geometry) {
*/
export default class GeojsonToComponents extends Component {

constructor (...args) {
super(...args);
this.state = {
geoJson: this.props.initialGeoJson,
geoStateBy: {
0: {
ref: "map",
style: {height: "100%"},
onClick: this._handle_map_click,
onZoomChanged: this._handle_map_zoom_changed,
},
1: {
ref: "centerMarker",
visible: true,
draggable: true,
onDragend: this._handle_marker_dragend,
onClick: this._handle_marker_click,
child: {
content: "Bermuda Triangle",
owner: "centerMarker",
},
},
3: {
onRightclick: this._handle_polygon_rightclick,
state = {
geoJson: this.props.initialGeoJson,
geoStateBy: {
0: {
ref: "map",
style: {height: "100%"},
onClick: this._handle_map_click,
onZoomChanged: this._handle_map_zoom_changed,
},
1: {
ref: "centerMarker",
visible: true,
draggable: true,
onDragend: this._handle_marker_dragend,
onClick: this._handle_marker_click,
child: {
content: "Bermuda Triangle",
owner: "centerMarker",
},
},
};
3: {
onRightclick: this._handle_polygon_rightclick,
},
},
}

_handle_map_click = () => {
Expand Down
21 changes: 9 additions & 12 deletions examples/gh-pages/scripts/components/GettingStarted.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@ const {update} = addons;
*/
export default class GettingStarted extends Component {

constructor (...args) {
super(...args);
this.state = {
markers: [{
position: {
lat: 25.0112183,
lng: 121.52067570000001,
},
key: "Taiwan",
defaultAnimation: 2
}],
};
state = {
markers: [{
position: {
lat: 25.0112183,
lng: 121.52067570000001,
},
key: "Taiwan",
defaultAnimation: 2
}],
}

/*
Expand Down
21 changes: 9 additions & 12 deletions examples/simplemap/scripts/SimpleMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@ const {update} = addons;
*/
export default class SimpleMap extends Component {

constructor (...args) {
super(...args);
this.state = {
markers: [{
position: {
lat: 25.0112183,
lng: 121.52067570000001,
},
key: "Taiwan",
defaultAnimation: 2
}],
};
state = {
markers: [{
position: {
lat: 25.0112183,
lng: 121.52067570000001,
},
key: "Taiwan",
defaultAnimation: 2,
}],
}

componentDidMount () {
Expand Down

0 comments on commit a8ea37a

Please sign in to comment.