diff --git a/frontend/src/component/maps/NaverMapSample.tsx b/frontend/src/component/maps/NaverMapSample.tsx new file mode 100644 index 00000000..b26b2b68 --- /dev/null +++ b/frontend/src/component/maps/NaverMapSample.tsx @@ -0,0 +1,25 @@ +import { useEffect, useRef } from 'react'; +import { setNaverMapSync } from '@/component/maps/naverMapUtils'; + +export interface INaverMapOptions { + lat: number; + lng: number; + zoom?: number; +} + +export const NaverMap = (props: INaverMapOptions) => { + const mapRef = useRef(null); + const mapOptions: INaverMapOptions = { + lat: props.lat, + lng: props.lng, + zoom: props.zoom, + }; + + useEffect(() => { + if (mapRef.current) { + setNaverMapSync(mapRef.current, mapOptions); + } + }, []); + + return
; +}; diff --git a/frontend/src/pages/Main.tsx b/frontend/src/pages/Main.tsx index 05437834..2d8323e8 100644 --- a/frontend/src/pages/Main.tsx +++ b/frontend/src/pages/Main.tsx @@ -5,8 +5,8 @@ import { Content } from '@/component/content/Content'; import { MdFormatListBulleted } from 'react-icons/md'; import { FooterContext } from '@/component/layout/footer/LayoutFooterProvider'; import { useNavigate } from 'react-router-dom'; +import { NaverMap } from '@/component/maps/NaverMapSample.tsx'; import { buttonActiveType } from '@/component/layout/enumTypes'; -import { CanvasWithMap } from '@/component/canvas/CanvasWithMap.tsx'; const contentData = [ { @@ -64,7 +64,7 @@ export const Main = () => { }} > {lat && lng ? ( - + ) : (
{error ? `Error: ${error}` : 'Loading'}