Skip to content

Commit ed09bd0

Browse files
committed
Added Google maps to the table for the city searched for.
1 parent 5e2206e commit ed09bd0

12 files changed

+38
-2
lines changed
Loading
Loading
Loading
Loading
Loading
Loading

index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@
1111
</body>
1212
<script src="/bundle.js"></script>
1313
</html>
14+
15+
16+
<!-- <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyChOgesyKbKNt04mvzBReNytSKn9bYPDC8"></script> -->

src/actions/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//using axios instead of .fetch() you can cut out the middle step of passing the results of the http request to the .json() method.
2+
// Axios just returns the data object you would expect.
3+
//It also handles errors better than .fetch() where the .catch() block does not run when an incorrect URL is entered
14
import axios from 'axios';
25

36
const API_KEY = '07a669a92354520dad8a3e91046461b4';

src/components/chart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function average(data){
99
export default (props) => {
1010
return(
1111
<div>
12-
<Sparklines svgHeight={120} svgWidth={180} data={props.data}>
12+
<Sparklines svgHeight={150} svgWidth={180} data={props.data}>
1313
<SparklinesLine color={props.color} />
1414
<SparklinesReferenceLine type="avg"/>
1515
</Sparklines>

src/components/google_map.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React, {Component} from 'react';
2+
3+
export default class GoogleMap extends Component{
4+
componentDidMount() {
5+
// const google = window.google;
6+
new google.maps.Map(this.refs.map, {
7+
zoom: 12,
8+
center: {
9+
lat: this.props.lat,
10+
lng: this.props.lon
11+
}
12+
});
13+
}
14+
15+
render() {
16+
return(
17+
// to reference this element after it has been rendered to the page use this.refs.map
18+
<div ref="map" />
19+
);
20+
}
21+
}
22+

0 commit comments

Comments
 (0)