mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
work and created develop branch
This commit is contained in:
3
Example Code/WeatherList/index.css
Normal file
3
Example Code/WeatherList/index.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.cardList {
|
||||
|
||||
}
|
||||
54
Example Code/WeatherList/index.js
Normal file
54
Example Code/WeatherList/index.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import Weather from "../Weather";
|
||||
|
||||
class WeatherList extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { periods: [] };
|
||||
}
|
||||
|
||||
remove() {
|
||||
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
this.state.periods.map((period, index) => {
|
||||
return <Weather
|
||||
key={index}
|
||||
name={period.name}
|
||||
temperature={period.temperature}
|
||||
temperatureUnit={period.temperatureUnit}
|
||||
detailedForecast={period.detailedForecast}
|
||||
dataclick={this.remove}
|
||||
/>
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
getData() {
|
||||
fetch("https://api.weather.gov/gridpoints/MLB/25,69/forecast")
|
||||
.then(response => response.json())
|
||||
.then(data => this.setState({ periods : data.properties.periods}))
|
||||
.then(data => console.log(data));
|
||||
this.setState({
|
||||
detailedForcast : 'Test Detailed forcast',
|
||||
name : 'Test data',
|
||||
temperature : '90',
|
||||
temperatureUnit : 'Celcius'});
|
||||
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getData();
|
||||
}
|
||||
|
||||
}
|
||||
export default WeatherList;
|
||||
Reference in New Issue
Block a user