From 4440331e0a2e9038d43cdc60c23512d37d9fa7b4 Mon Sep 17 00:00:00 2001 From: jimin Date: Wed, 31 Aug 2022 15:49:02 +0900 Subject: [PATCH] =?UTF-8?q?feature/map=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EC=A7=80=EB=8F=84=20=EC=97=B0=EA=B2=B0=EB=A7=8C=EB=90=A8=20#15?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 31 +++++++++++++++++++++++++++++++ package.json | 1 + pages/index.js | 2 ++ pages/map/NaverAPIMap.jsx | 37 +++++++++++++++++++++++++++++++++++++ pages/map/index.js | 17 +++++++++++------ public/img_rank.png | Bin 0 -> 3762 bytes styles/Map.module.css | 2 +- 7 files changed, 83 insertions(+), 7 deletions(-) create mode 100644 pages/map/NaverAPIMap.jsx create mode 100644 public/img_rank.png diff --git a/package-lock.json b/package-lock.json index 0391526..109bc86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "next": "12.2.3", "react": "18.2.0", "react-dom": "18.2.0", + "react-kakao-maps-sdk": "^1.1.3", "react-naver-maps": "^0.0.13" }, "devDependencies": { @@ -2353,6 +2354,11 @@ "node": ">=4.0" } }, + "node_modules/kakao.maps.d.ts": { + "version": "0.1.33", + "resolved": "https://registry.npmjs.org/kakao.maps.d.ts/-/kakao.maps.d.ts-0.1.33.tgz", + "integrity": "sha512-ANsAznVkdnaV1EhZcbE3wcEOWbJSX7YOs3Cka1gOPzMDVibNQ6mm8zgju26R1qSAKWBNNGbDZy5BmtZ6pQ8peA==" + }, "node_modules/language-subtag-registry": { "version": "0.3.22", "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz", @@ -2999,6 +3005,18 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "license": "MIT" }, + "node_modules/react-kakao-maps-sdk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/react-kakao-maps-sdk/-/react-kakao-maps-sdk-1.1.3.tgz", + "integrity": "sha512-r3ypRhgG17nCO1g6umYBLLVQo/hV3gi0EasFxTjr3A6ghV+UfyqTTYYmO6hYyVOQtrBkn9il3vaV8j/AHabj1A==", + "dependencies": { + "kakao.maps.d.ts": "^0.1.33" + }, + "peerDependencies": { + "react": ">=16.9.0", + "react-dom": ">=16.9.0" + } + }, "node_modules/react-naver-maps": { "version": "0.0.13", "resolved": "https://registry.npmjs.org/react-naver-maps/-/react-naver-maps-0.0.13.tgz", @@ -5223,6 +5241,11 @@ "object.assign": "^4.1.2" } }, + "kakao.maps.d.ts": { + "version": "0.1.33", + "resolved": "https://registry.npmjs.org/kakao.maps.d.ts/-/kakao.maps.d.ts-0.1.33.tgz", + "integrity": "sha512-ANsAznVkdnaV1EhZcbE3wcEOWbJSX7YOs3Cka1gOPzMDVibNQ6mm8zgju26R1qSAKWBNNGbDZy5BmtZ6pQ8peA==" + }, "language-subtag-registry": { "version": "0.3.22", "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz", @@ -5643,6 +5666,14 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "react-kakao-maps-sdk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/react-kakao-maps-sdk/-/react-kakao-maps-sdk-1.1.3.tgz", + "integrity": "sha512-r3ypRhgG17nCO1g6umYBLLVQo/hV3gi0EasFxTjr3A6ghV+UfyqTTYYmO6hYyVOQtrBkn9il3vaV8j/AHabj1A==", + "requires": { + "kakao.maps.d.ts": "^0.1.33" + } + }, "react-naver-maps": { "version": "0.0.13", "resolved": "https://registry.npmjs.org/react-naver-maps/-/react-naver-maps-0.0.13.tgz", diff --git a/package.json b/package.json index cc647d3..2cc7743 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "next": "12.2.3", "react": "18.2.0", "react-dom": "18.2.0", + "react-kakao-maps-sdk": "^1.1.3", "react-naver-maps": "^0.0.13" }, "devDependencies": { diff --git a/pages/index.js b/pages/index.js index b1b0fad..0ce2015 100644 --- a/pages/index.js +++ b/pages/index.js @@ -7,6 +7,8 @@ export default function Home() { const [count, setCount] = useState(0); // 글자 수 카운터 변수 const scrollRef = useRef(); + console.log(process.env.NEXT_PUBLIC_MAP_KEY) + useEffect(() => { const textInterval = setInterval(() => { if (count < totalText.length) { diff --git a/pages/map/NaverAPIMap.jsx b/pages/map/NaverAPIMap.jsx new file mode 100644 index 0000000..d61d2cf --- /dev/null +++ b/pages/map/NaverAPIMap.jsx @@ -0,0 +1,37 @@ +import React, { FC, useState, useEffect } from 'react'; +import { CustomOverlayMap } from 'react-kakao-maps-sdk'; +const { kakao } = window; + +export const NaverAPIMap = () => { + const [map,setMap] = useState(null); + + //처음 지도 그리기 + useEffect(()=>{ + + + const container = document.getElementById('map'); + const options = { center: new kakao.maps.LatLng(33.450701, 126.570667) }; + const kakaoMap = new kakao.maps.Map(container, options); + setMap(kakaoMap); + },[]) + + return ( +
+ +
+ + +
+
+ ); +}; + +export default NaverAPIMap; \ No newline at end of file diff --git a/pages/map/index.js b/pages/map/index.js index 7fb03a0..f09c211 100644 --- a/pages/map/index.js +++ b/pages/map/index.js @@ -1,12 +1,14 @@ import { useEffect, useRef, useState } from "react"; import styles from "../../styles/Map.module.css"; +import NaverAPIMap from "./NaverAPIMap"; -export default function Map() { - - +export default function Map() { return ( -
+ <> +