Skip to content

Commit

Permalink
♻️ Refactor: MallangMap 에서 마커 클릭시 setTotalData 셋터를 이용하여 모달 전체 데이터 변경,…
Browse files Browse the repository at this point in the history
… 모달 출력시키기 (#27)
  • Loading branch information
SoRaang committed Dec 8, 2024
1 parent f341e59 commit 78cf78d
Show file tree
Hide file tree
Showing 11 changed files with 4,838 additions and 42 deletions.
Binary file modified public/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/temp-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/marker-alpha.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/marker-beta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/marker-gamma.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 23 additions & 6 deletions src/components/MallangMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import ToolTip from './common/ToolTip';
import AreaInfoPanel from './layout/AreaInfoPanel';
import MarkerCategory from './layout/MarkerCategory';
import getLatestLocation from '../utils/getLatestLocation';
import markerLogo from '../assets/images/logo.png';
import markerImageAlpha from '../assets/images/marker-alpha.png';
import markerImageBeta from '../assets/images/marker-beta.png';
import markerImageGamma from '../assets/images/marker-gamma.png';
import tempDB from '../datas/temp-db.json'; // 임시 가라 데이터

const MallangMap = () => {
Expand Down Expand Up @@ -33,9 +37,9 @@ const MallangMap = () => {
return currentLocation;
};

const toggleModal = useModalStore((state) => state.toggleModal);
const setModalType = useModalStore((state) => state.setModalType);
const setModalData = useModalStore((state) => state.setModalData);
const { toggleModal, setModalType, setTotalData } = useModalStore(
(state) => state,
);

const handleMapDrag = (map) => {
// 지도 드래그로 중심점 이동시 핸들러
Expand Down Expand Up @@ -201,16 +205,29 @@ const MallangMap = () => {
lng: item.longitude,
}}
image={{
src: 'https://picsum.photos/64/64',
src:
item.threadType === 'places'
? markerImageAlpha
: item.threadType === 'missing'
? markerImageBeta
: item.threadType === 'rescue'
? markerImageGamma
: markerLogo,
size: {
width: 64,
height: 64,
},
}}
title={item.threadTitle}
key={index}
onClick={() => console.log(item.threadType)}
/>
onClick={() => {
setModalType(item.threadType);
setTotalData(item);
toggleModal(true);
}}
>
<div>{item.threadTitle}</div>
</MapMarker>
);
})}
</Map>
Expand Down
Loading

0 comments on commit 78cf78d

Please sign in to comment.