Skip to content

Commit

Permalink
Merge pull request #142 from Plick-pop-in/dev
Browse files Browse the repository at this point in the history
feat: click event 인포드로우에도 추가
  • Loading branch information
hyo-limilimee authored Jul 30, 2024
2 parents 2f18e03 + 38e16d5 commit db2df0c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/component/map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Map = () => {
const url = `http://www.plick.shop/popupdetail/${popup.popupId}`;
window.location.href = url;
};

const handleSearch = () => {
const searchData = {
fashion: selectedCategories.includes("fashion"),
Expand Down Expand Up @@ -81,7 +81,7 @@ const Map = () => {
console.log("주소: ", popupAddress);

const geocoder = new kakao.current.maps.services.Geocoder();
geocoder.addressSearch(popupAddress, function(result, status) {
geocoder.addressSearch(popupAddress, function (result, status) {
console.log("Geocoder 호출 결과:", result, status); // 디버깅용 로그

if (status === kakao.current.maps.services.Status.OK) {
Expand All @@ -93,13 +93,14 @@ const Map = () => {
});

var infowindow = new kakao.current.maps.InfoWindow({
content: `<div style="width:150px;text-align:center;padding:6px 0;">${popup.popupName}</div>`
content: `<div style="width:150px;text-align:center;padding:6px 0; cursor: pointer;" onclick="window.location.href='http://www.plick.shop/popupdetail/${popup.popupId}'">${popup.popupName}</div>`
});
infowindow.open(mapRef.current, marker);


// 마커에 클릭 이벤트 리스너 추가
kakao.current.maps.event.addListener(marker, 'click', () => handleMarkerClick(popup));
// 인포윈도우에 클릭 이벤트 리스너 추가
kakao.current.maps.event.addListener(infowindow, 'click', () => handleMarkerClick(popup));

mapRef.current.setCenter(coords);
} else {
Expand Down Expand Up @@ -180,10 +181,10 @@ const Map = () => {
전체
</button>
<button
className={"region-button " + (selectedRegion === "서울" ? "selected" : "")}
onClick={() => handleRegionSelection("서울")}
className={"region-button " + (selectedRegion === "서울" ? "selected" : "")}
onClick={() => handleRegionSelection("서울")}
>
서울특별시
서울특별시
</button>
<button
className={"region-button " + (selectedRegion === "경기" ? "selected" : "")}
Expand Down

0 comments on commit db2df0c

Please sign in to comment.