Skip to content

Commit

Permalink
feature/map
Browse files Browse the repository at this point in the history
카카오 지도 연결만됨
#15
  • Loading branch information
moana16 committed Aug 31, 2022
1 parent fbf7113 commit 4440331
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 7 deletions.
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 2 additions & 0 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
37 changes: 37 additions & 0 deletions pages/map/NaverAPIMap.jsx
Original file line number Diff line number Diff line change
@@ -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 (
<div
style={{
width: '100%',
height: '100%',
marginLeft: '5px',
marginRight: '5px',
}}
level={3}
>

<div id="map" style={{ width: '100%', height: '2000px' }}>


</div>
</div>
);
};

export default NaverAPIMap;
17 changes: 11 additions & 6 deletions pages/map/index.js
Original file line number Diff line number Diff line change
@@ -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 (
<div className={styles.map}>
<>
<script type="text/javascript" src="//dapi.kakao.com/v2/maps/sdk.js?appkey=1664a34e52ea5802af4d289cbdeef3ed"/>

<NaverAPIMap>
<div className={styles.stardust_container}>
<div className={styles.stardust_black}></div>
<div className={styles.stardust_yellow}></div>
Expand All @@ -25,7 +27,10 @@ export default function Map() {
<div className={styles.qr_btn}></div>

</div>

</div>
</NaverAPIMap>
</>

);


}
Binary file added public/img_rank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion styles/Map.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
position: fixed;
bottom: 50px;
left: 50px;
content: url(../public/logo_small.png);
content: url(../public/img_rank.png);
}
.button_container {
position: fixed;
Expand Down

0 comments on commit 4440331

Please sign in to comment.