From 51dc2aa1c6fbdee580d95d845d1756e8b42942cf Mon Sep 17 00:00:00 2001 From: sanguu Date: Fri, 30 Sep 2022 14:36:52 +0900 Subject: [PATCH] =?UTF-8?q?=EB=82=A0=EC=94=A8=20=EB=B9=84=ED=96=89=20?= =?UTF-8?q?=EA=B2=80=EC=83=89-=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80(css?= =?UTF-8?q?=EB=AF=B8=EC=88=98=EC=A0=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/weather/WeatherView.js | 120 +++++++++++++++++++++++++++++-- 1 file changed, 115 insertions(+), 5 deletions(-) diff --git a/src/views/weather/WeatherView.js b/src/views/weather/WeatherView.js index fadde89..2220598 100644 --- a/src/views/weather/WeatherView.js +++ b/src/views/weather/WeatherView.js @@ -1,5 +1,20 @@ import { WINDY_KEY } from '../../configs/constants'; - const WeatherView = () => { +import React, { useEffect, useState } from 'react'; +import { Search } from 'react-feather' +import { Card, CardBody, Button, Input, Row, Col, InputGroup, InputGroupAddon, InputGroupText, FormGroup } from 'reactstrap'; +import { useDispatch, useSelector } from 'react-redux'; +import { flightPlanAPI } from '../../modules/basis/flight/apis/basisFlightApi'; + + +const WeatherView = () => { + + const [query, setQuery] = useState(''); + const [searchRes, setSearchRes] = useState([]); + const [isSearch, setIsSearch] = useState(false); + const dispatch = useDispatch(); + const [map, setMap] = useState(); + + const options = { // Required: API key key: WINDY_KEY // REPLACE WITH YOUR KEY !!! @@ -9,12 +24,107 @@ import { WINDY_KEY } from '../../configs/constants'; // Optional: Initial state of the map }; + + const handleSearch = async () => { + const res = await flightPlanAPI.searchArea({ query: query }); + setIsSearch(true); + setSearchRes(res.data.items); + }; + + const handleChange = e => { + const { name, value } = e.target; + + if (name == 'searchInput') { + setQuery(value); + } + }; + const handleCoord = (mapx, mapy) => { + let utmk = naver.maps.TransCoord.fromTM128ToUTMK(naver.maps.Point(mapx, mapy)); + let latlng = naver.maps.TransCoord.fromUTMKToLatLng(utmk); + setIsSearch(false); + + setMap(latlng); + let options = { + duration: 800, + easing: 'easeOutCubic' + } + // map.morph(latlng, 16, options) + console.log(map); + + } + const handleEnter = e => { + if (e.key == 'Enter') { + handleSearch(); + } + }; return ( <> - +
+
+ + + + + + + + +
+ +
+
+
+ {!map ? + +