-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
65 additions
and
7 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,40 @@ | ||
import React, { useEffect } from 'react'; | ||
import vectorIcon from '../../assets/image/detailHeart.png'; | ||
|
||
const NaverMap = () => { | ||
useEffect(() => { | ||
let map = null; | ||
let marker = null; | ||
const initMap = () => { | ||
map = new naver.maps.Map('map', { | ||
//지도 추가, 좌표를 기점으로 주변 지도가 추가된다. | ||
center: new naver.maps.LatLng(35.8, 128.839573), | ||
zoom: 7, | ||
}); | ||
|
||
marker = new naver.maps.Marker({ | ||
position: new naver.maps.LatLng(35.8, 128.839573), //Marker 추가, 좌표에 마커가 찍힌다. | ||
map: map, | ||
}); | ||
|
||
naver.maps.Event.addListener(map, 'click', function (e) { | ||
marker.setPosition(e.latlng); | ||
console.log(e.latlng); | ||
}); | ||
}; | ||
initMap(); | ||
}, []); | ||
|
||
const mapStyle = { | ||
width: '70vw', | ||
height: '32vw', | ||
}; | ||
|
||
return ( | ||
<div> | ||
<div id="map" style={mapStyle} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NaverMap; |