Interactive interface for browsing global, full-resolution satellite imagery
Map data prop to tour boxes and dynamically output each tour box
ZachTRice39ce7dc9262c
diff --git a/web/js/components/tour/tour-box.js b/web/js/components/tour/tour-box.jsindex 7c234f27f..c63b9b245 100644--- a/web/js/components/tour/tour-box.js+++ b/web/js/components/tour/tour-box.js@@ -2,22 +2,18 @@ import React from 'react';class TourBox extends React.Component {render() {- if (this.props.data) {- return (- <a href="#" className={this.props.className} onClick={this.props.startTour}>- <div className="tour-box-content">- <div className="tour-box-header">- <h3 className="tour-box-title">{this.props.data[this.props.box].title}</h3>- </div>- <div className="tour-box-description">- <p>{this.props.data[this.props.box].description}</p>- </div>+ return (+ <a href="#" className={this.props.className} onClick={(e) => this.props.startTour(e, this.props.box)}>+ <div className="tour-box-content">+ <div className="tour-box-header">+ <h3 className="tour-box-title">{this.props.title}</h3></div>- </a>- );- } else {- return null;- }+ <div className="tour-box-description">+ <p>{this.props.description}</p>+ </div>+ </div>+ </a>+ );}}diff --git a/web/js/components/tour/tour-boxes.js b/web/js/components/tour/tour-boxes.jsindex 47a424dc8..df8b7d2e8 100644--- a/web/js/components/tour/tour-boxes.js+++ b/web/js/components/tour/tour-boxes.js@@ -4,67 +4,14 @@ import TourBox from './tour-box';class TourBoxes extends React.Component {render() {if (this.props.data) {+ var data = this.props.data;+ var startTour = this.props.startTour;return (<div className="tour-box-container"><div className="tour-box-row">- <TourBox- box="0"- data={this.props.data}- startTour={this.props.startTour}- className={'tour-box ' + this.props.data[0].type}- ></TourBox>- <TourBox- box="1"- data={this.props.data}- startTour={this.props.startTour}- className={'tour-box ' + this.props.data[1].type}- ></TourBox>- <TourBox- box="2"- data={this.props.data}- startTour={this.props.startTour}- className={'tour-box ' + this.props.data[2].type}- ></TourBox>- </div>- <div className="tour-box-row">- <TourBox- box="3"- data={this.props.data}- startTour={this.props.startTour}- className={'tour-box ' + this.props.data[3].type}- ></TourBox>- <TourBox- box="4"- data={this.props.data}- startTour={this.props.startTour}- className={'tour-box ' + this.props.data[4].type}- ></TourBox>- <TourBox- box="5"- data={this.props.data}- startTour={this.props.startTour}- className={'tour-box ' + this.props.data[5].type}- ></TourBox>- </div>- <div className="tour-box-row">- <TourBox- box="6"- data={this.props.data}- startTour={this.props.startTour}- className={'tour-box ' + this.props.data[6].type}- ></TourBox>- <TourBox- box="7"- data={this.props.data}- startTour={this.props.startTour}- className={'tour-box ' + this.props.data[7].type}- ></TourBox>- <TourBox- box="8"- data={this.props.data}- startTour={this.props.startTour}- className={'tour-box ' + this.props.data[8].type}- ></TourBox>+ {data.map(function(object, i) {+ return (<TourBox key={i} box={i} title={object.title} description={object.description} startTour={startTour} className={'tour-box ' + object.type}/>);+ })}</div></div>);