권주희

display the result of current air information

- display the result of current air information
- add icon
...@@ -6,6 +6,12 @@ import "./home.css"; ...@@ -6,6 +6,12 @@ import "./home.css";
6 import { Map, Marker, MarkerClusterer, Polyline } from "react-kakao-maps"; 6 import { Map, Marker, MarkerClusterer, Polyline } from "react-kakao-maps";
7 import "bootstrap/dist/css/bootstrap.min.css"; 7 import "bootstrap/dist/css/bootstrap.min.css";
8 import API from "./API"; 8 import API from "./API";
9 +import veryGood from "./gradeIcon/cool.png";
10 +import good from "./gradeIcon/smile.png";
11 +import bad from "./gradeIcon/angry.png";
12 +import veryBad from "./gradeIcon/devil.png";
13 +import next from "./gradeIcon/next.png";
14 +
9 /* global kakao */ 15 /* global kakao */
10 16
11 export default class Home extends Component { 17 export default class Home extends Component {
...@@ -21,6 +27,7 @@ export default class Home extends Component { ...@@ -21,6 +27,7 @@ export default class Home extends Component {
21 placeSearch: new kakao.maps.services.Places(), 27 placeSearch: new kakao.maps.services.Places(),
22 infoWindow: new kakao.maps.CustomOverlay({}), 28 infoWindow: new kakao.maps.CustomOverlay({}),
23 region: "은평구청", 29 region: "은평구청",
30 + curAirCondition: null,
24 31
25 // curAirCondition: null, 32 // curAirCondition: null,
26 // routeInformation: null, 33 // routeInformation: null,
...@@ -328,6 +335,52 @@ export default class Home extends Component { ...@@ -328,6 +335,52 @@ export default class Home extends Component {
328 335
329 render() { 336 render() {
330 let currentAirCondition = null; 337 let currentAirCondition = null;
338 + if (this.state.curAirCondition != null) {
339 + let pm10Image = null;
340 + let pm25Image = null;
341 + switch (this.state.curAirCondition.pm10Grade) {
342 + case "1":
343 + pm10Image = <img src={veryGood} width="50px" heigth="100px" />;
344 + break;
345 + case "2":
346 + pm10Image = <img src={good} width="50px" heigth="100px" />;
347 + break;
348 + case "3":
349 + pm10Image = <img src={bad} width="50px" heigth="100px" />;
350 + break;
351 + case "4":
352 + pm10Image = <img src={veryBad} width="50px" heigth="100px" />;
353 + break;
354 + default:
355 + pm10Image = null;
356 + }
357 + switch (this.state.curAirCondition.pm25Grade) {
358 + case "1":
359 + pm25Image = <img src={veryGood} width="50px" heigth="100px" />;
360 + break;
361 + case "2":
362 + pm25Image = <img src={good} width="50px" heigth="100px" />;
363 + break;
364 + case "3":
365 + pm25Image = <img src={bad} width="50px" heigth="100px" />;
366 + break;
367 + case "4":
368 + pm25Image = <img src={veryBad} width="50px" heigth="100px" />;
369 + break;
370 + default:
371 + pm25Image = null;
372 + }
373 + currentAirCondition = (
374 + <h5>
375 + <br />
376 + <br />
377 + <br /> 미세먼지 등급 <br /> {pm10Image} <br />
378 + 미세먼지 지수 : {this.state.curAirCondition.pm10Value} <br />
379 + 초미세먼지 등급 <br /> {pm25Image} <br />
380 + 초미세먼지 지수 : {this.state.curAirCondition.pm25Value} <br />{" "}
381 + </h5>
382 + );
383 + }
331 let routeAirCondition = null; 384 let routeAirCondition = null;
332 385
333 return ( 386 return (
......