-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
npm build 문제로 인해 아직 완성되지 않은 Map 컴포넌트 일단 추가하겠습니다.
- Loading branch information
1 parent
e8718b3
commit c133490
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
|
||
const { kakao } = window; | ||
|
||
// 지도 띄우기 | ||
const LoadMap = () => { | ||
const [map, setMap] = useState(null); | ||
|
||
// useEffect []로 script 태그 내용 넣어주는게 가장 간단한 방식 + API 문서대로 하기 쉬울듯 | ||
useEffect(() => { | ||
const container = document.getElementById('map'); | ||
const options = { | ||
// 중간 위치 -> 나중에 사용자 위치로 바꿔야 됨 | ||
center: new kakao.maps.LatLng(35.175483, 126.906988), | ||
// 확대 수준 | ||
level: 4, | ||
}; | ||
const kakaoMap = new kakao.maps.Map(container, options); | ||
setMap(kakaoMap); | ||
}, []); | ||
|
||
return <div id="map" className="w-[500px] h-[400px] mx-2"></div>; | ||
}; | ||
|
||
const TestMap = () => { | ||
// const [data, isLoading, isSuccess] = useQuery(['shelter'], () => { | ||
// fetch(`${process.env.REACT_APP_URI}/shelter/filter`, { | ||
// method: 'POST', | ||
// headers: { | ||
// 'Content-Type': 'application/json', | ||
// }, | ||
// body: JSON.stringify(), | ||
// }).then((res) => { | ||
// return res.json(); | ||
// }); | ||
// }); | ||
const currentPosition = { lat: 35.1759293, lon: 126.9149701 }; | ||
|
||
return <LoadMap />; | ||
}; | ||
|
||
export default TestMap; |