Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Remove `React.createFactory`

Jo Sprague1264ea443a82
diff --git a/web/js/animation/range-select.js b/web/js/animation/range-select.js
index e5055521c..3a5961abc 100644
--- a/web/js/animation/range-select.js
+++ b/web/js/animation/range-select.js
@@ -9,7 +9,6 @@ export function animationRangeSelect(models, config, ui) {
var self = {};
var model;
var timeline = ui.timeline;
- var rangeSelectionFactory = React.createFactory(RangeSelector);
var $mountLocation = $('#wv-rangeselector-case');
var $footer = $('#timeline-footer');
var $header = $('#timeline-header');
@@ -99,7 +98,10 @@ export function animationRangeSelect(models, config, ui) {
onDrag: self.updateRange,
onRangeClick: self.onRangeClick
};
- self.reactComponent = ReactDOM.render(rangeSelectionFactory(options), $mountLocation[0]);
+ self.reactComponent = ReactDOM.render(
+ React.createElement(RangeSelector, options),
+ $mountLocation[0]
+ );
};
/*
diff --git a/web/js/animation/widget.js b/web/js/animation/widget.js
index d61c43008..7139ca9dd 100644
--- a/web/js/animation/widget.js
+++ b/web/js/animation/widget.js
@@ -11,7 +11,6 @@ export function animationWidget (models, config, ui) {
var self = {};
var timeline = ui.timeline;
var model = models.anim;
- var widgetFactory = React.createFactory(AnimationWidget);
var $timelineFooter;
var $animateButton;
var dataModel;
@@ -26,12 +25,32 @@ export function animationWidget (models, config, ui) {
*
*/
self.init = function () {
- var Widget;
-
- Widget = self.initWidget();
- // mount react component
$animateButton = $('#animate-button');
- self.reactComponent = ReactDOM.render(Widget, $('#wv-animation-widet-case')[0]);
+
+ var props = {
+ onPushPlay: self.onPressPlay,
+ onPushLoop: self.onPressLoop,
+ onPushPause: self.onPressPause,
+ onPushGIF: self.onPressGIF,
+ looping: model.rangeState.loop,
+ increment: self.getIncrements(), // config.currentZoom is a number: 1,2,3
+ incrementArray: loWithout(zooms, self.getIncrements()), // array of zooms without current zoom
+ onDateChange: self.dateUpdate,
+ sliderLabel: 'Frames Per Second',
+ sliderSpeed: model.rangeState.speed,
+ onZoomSelect: self.onZoomSelect,
+ onSlide: self.onRateChange,
+ startDate: new Date(model.rangeState.startDate),
+ endDate: new Date(model.rangeState.endDate),
+ minDate: models.date.minDate(),
+ maxDate: models.date.maxDate(),
+ onClose: self.toggleAnimationWidget
+ };
+
+ self.reactComponent = ReactDOM.render(
+ React.createElement(AnimationWidget, props),
+ $('#wv-animation-widet-case')[0]
+ );
$timelineFooter = $('#timeline-footer');
$animateButton.on('click', function () {
googleAnalytics.event('Animation', 'Click', 'Animation Icon');
@@ -82,38 +101,6 @@ export function animationWidget (models, config, ui) {
});
};
- /*
- * Widget initializer
- * passes initial props
- *
- * @method initWidget
- * @static
- *
- * @returns {void}
- *
- */
- self.initWidget = function () {
- var rangeState = model.rangeState;
- return widgetFactory({
- onPushPlay: self.onPressPlay,
- onPushLoop: self.onPressLoop,
- onPushPause: self.onPressPause,
- onPushGIF: self.onPressGIF,
- looping: model.rangeState.loop,
- increment: self.getIncrements(), // config.currentZoom is a number: 1,2,3
- incrementArray: loWithout(zooms, self.getIncrements()), // array of zooms without current zoom
- onDateChange: self.dateUpdate,
- sliderLabel: 'Frames Per Second',
- sliderSpeed: rangeState.speed,
- onZoomSelect: self.onZoomSelect,
- onSlide: self.onRateChange,
- startDate: new Date(rangeState.startDate),
- endDate: new Date(rangeState.endDate),
- minDate: models.date.minDate(),
- maxDate: models.date.maxDate(),
- onClose: self.toggleAnimationWidget
- });
- };
/*
* Determines whether to play
* animation or pause animation