Commit 2757306f authored by Kim, Subin's avatar Kim, Subin
Browse files

cinemaInfo 자식컴포넌트로 넘겨줘서 주소정보 받기

parent cf16aae7
...@@ -34,7 +34,7 @@ const CinemaEdit = () => { ...@@ -34,7 +34,7 @@ const CinemaEdit = () => {
<button className="btn btn-dark" type="button" id="currentMap" onClick={() => setSearch(cinemaInfo.keyword)}><i className="bi bi-search"></i></button> <button className="btn btn-dark" type="button" id="currentMap" onClick={() => setSearch(cinemaInfo.keyword)}><i className="bi bi-search"></i></button>
</div> </div>
<div className="d-flex justify-content-center mb-5"> <div className="d-flex justify-content-center mb-5">
<KakaoMap keyword={search} /> <KakaoMap keyword={search} cinemaInfo={cinemaInfo} setCinemaInfo={setCinemaInfo} />
</div> </div>
</> </>
) )
......
...@@ -3,7 +3,7 @@ import styles from "./kakao-map.module.scss"; ...@@ -3,7 +3,7 @@ import styles from "./kakao-map.module.scss";
const { kakao } = window; const { kakao } = window;
const KakaoMap = ({ keyword }) => { const KakaoMap = ({ keyword, cinemaInfo, setCinemaInfo }) => {
const kakaoMapDiv = useRef(null) const kakaoMapDiv = useRef(null)
const menu = useRef(null) const menu = useRef(null)
const searchList = useRef(null) const searchList = useRef(null)
...@@ -93,6 +93,9 @@ const KakaoMap = ({ keyword }) => { ...@@ -93,6 +93,9 @@ const KakaoMap = ({ keyword }) => {
itemEl.style.background = '#fff'; itemEl.style.background = '#fff';
infowindow.close(); infowindow.close();
}; };
itemEl.onclick = function () {
setCinemaInfo({ ...cinemaInfo, address: place.address_name })
}
} }
}, [keyword]) }, [keyword])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment