Skip to content

Commit

Permalink
Merge pull request #486 from LEEJW1953/fe-fix-map
Browse files Browse the repository at this point in the history
[Fix] 지도 초기 좌표 추가, 마커 이미지 경로 수정
  • Loading branch information
LEEJW1953 authored Dec 13, 2023
2 parents 14765fe + 2d1c65d commit e9d265d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/frontend/src/components/Map/Marker.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import markerGreen from '@/assets/icons/marker-green.svg';
import markerRed from '@/assets/icons/marker-red.svg';
import { TMap, TMapLatLng } from '@/types';
import { reactElementToString } from '@/utils';

Expand All @@ -19,10 +21,11 @@ export function Marker({
theme,
labelText,
}: MarkerProps) {
const markerIcon = theme === 'green' ? markerGreen : markerRed;
return new Tmapv3.Marker({
position,
map: mapContent,
icon: `/src/assets/icons/marker-${theme}.svg`,
icon: markerIcon,
iconSize: new Tmapv3.Size(50, 50),
label: labelText
? reactElementToString(
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/components/Map/index.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const label = recipe({
padding: '0.2rem',
color: grayscaleWhite,
borderRadius: '0.5rem',
top: '-6.5rem',
top: '-5.5rem',
left: '50%',
transform: 'translate(-50%)',
whiteSpace: 'pre',
Expand Down
3 changes: 3 additions & 0 deletions app/frontend/src/hooks/useMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
DEFAULT_ZOOM_LEVEL,
MAX_ZOOM_LEVEL,
MIN_ZOOM_LEVEL,
INITIAL_LATITUDE,
INITIAL_LONGITUDE,
} from '@/constants';
import { TMap, TMapMarker } from '@/types';

Expand All @@ -21,6 +23,7 @@ export const useMap = (mapRef: React.RefObject<HTMLDivElement>) => {
}

const map = new Tmapv3.Map('map', {
center: new Tmapv3.LatLng(INITIAL_LATITUDE, INITIAL_LONGITUDE),
zoom: DEFAULT_ZOOM_LEVEL,
zoomControl: false,
});
Expand Down

0 comments on commit e9d265d

Please sign in to comment.