sdy

update menu style and get confirmed data

1 -import React from "react"; 1 +import React, {useEffect, useState} from "react";
2 +import axios from "axios";
3 +
4 +const getAcc = async () => {
5 + const res = await axios.get("/api/watson/corona");
6 + return res.data.response.body.items.item.decideCnt;
7 +}
2 8
3 const Menu = () => { 9 const Menu = () => {
10 + const [acc, setAcc] = useState(0);
11 + useEffect(() => {
12 + getAcc().then(data => {
13 + setAcc(data)
14 + }).catch(e => {
15 + console.log("e : ", e);
16 + })
17 + }, []);
18 +
4 return ( 19 return (
5 <div className="menu-box"> 20 <div className="menu-box">
6 <div className="menu-header"> 21 <div className="menu-header">
...@@ -9,6 +24,21 @@ const Menu = () => { ...@@ -9,6 +24,21 @@ const Menu = () => {
9 </div> 24 </div>
10 <div className="menu-contents"> 25 <div className="menu-contents">
11 <div className="menu-item"> 26 <div className="menu-item">
27 + <div className="pic bar"></div>
28 + <div className="corona-cnt-box">
29 + <a href="http://ncov.mohw.go.kr/">
30 + <div className="corona-cnt-today">
31 + <span> 금일 확진자 </span>
32 + <span className="cnt"> 541 </span>
33 + </div>
34 + <div className="corona-cnt-acc">
35 + <span> 누적 확진자 </span>
36 + <span className="cnt">{acc}</span>
37 + </div>
38 + </a>
39 + </div>
40 + </div>
41 + <div className="menu-item">
12 <div className="pic call"></div> 42 <div className="pic call"></div>
13 <a href="tel:+821339">질병 관리청 콜센터 1339</a> 43 <a href="tel:+821339">질병 관리청 콜센터 1339</a>
14 </div> 44 </div>
...@@ -17,10 +47,6 @@ const Menu = () => { ...@@ -17,10 +47,6 @@ const Menu = () => {
17 <a href="http://ncov.mohw.go.kr/baroView4.do">코로나 예방 수칙</a> 47 <a href="http://ncov.mohw.go.kr/baroView4.do">코로나 예방 수칙</a>
18 </div> 48 </div>
19 <div className="menu-item"> 49 <div className="menu-item">
20 - <div className="pic bar"></div>
21 - <a href="">확진현황 (axios )</a>
22 - </div>
23 - <div className="menu-item">
24 <div className="pic vaccine"></div> 50 <div className="pic vaccine"></div>
25 <a href="https://ncv.kdca.go.kr/menu.es?mid=a10117030000">백신 접종 정보</a> 51 <a href="https://ncv.kdca.go.kr/menu.es?mid=a10117030000">백신 접종 정보</a>
26 </div> 52 </div>
......