-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
49 additions
and
45 deletions.
There are no files selected for viewing
29 changes: 18 additions & 11 deletions
29
src/app/(playground)/playground/map/_components/AddressSearchButton/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,33 @@ | ||
'use client' | ||
"use client"; | ||
|
||
import { useKakaoAddress } from "~/app/(playground)/playground/map/_store/KakaoAdressStore"; | ||
|
||
export default function AddressSearchButton(){ | ||
export default function AddressSearchButton() { | ||
const { coordinate, setCoordinate } = useKakaoAddress(); | ||
const handleClickButton = () => { | ||
new window.daum.Postcode({ | ||
oncomplete: (addressData: any) => { | ||
const geocoder = new window.kakao.maps.services.Geocoder(); | ||
geocoder.addressSearch( | ||
addressData.address, | ||
((result: any, status: any) => { | ||
(result: any, status: any) => { | ||
const currentPositions = new window.kakao.maps.LatLng( | ||
result[0].y, | ||
result[0].x | ||
result[0].x, | ||
); | ||
setCoordinate(currentPositions.Ma, currentPositions.La) | ||
}) | ||
) | ||
} | ||
setCoordinate(currentPositions.Ma, currentPositions.La); | ||
}, | ||
); | ||
}, | ||
}).open(); | ||
} | ||
}; | ||
|
||
return <button onClick={handleClickButton} className={'border rounded-xl bg-blue-300 p-2 text-white bold'}>내 주소 찾기</button> | ||
} | ||
return ( | ||
<button | ||
onClick={handleClickButton} | ||
className={"bold rounded-xl border bg-blue-300 p-2 text-white"} | ||
> | ||
내 주소 찾기 | ||
</button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
import KakaoMap from "~/app/(playground)/playground/map/_components/KakaoMap"; | ||
import AddressSearchButton from "~/app/(playground)/playground/map/_components/AddressSearchButton"; | ||
import { useKakaoAddress } from "~/app/(playground)/playground/map/_store/KakaoAdressStore"; | ||
|
||
import KakaoMap from "~/app/(playground)/playground/map/_components/KakaoMap"; | ||
|
||
export default function KaKaoMapPage() { | ||
|
||
return( | ||
return ( | ||
<div> | ||
<div> | ||
<KakaoMap height={"400px"} width={"100%"} addCenterPin={true} /> | ||
<AddressSearchButton /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ export const metadata: Metadata = { | |
description: "당신의 환대, 초대장 플랫폼 '인비' 입니다.", | ||
}; | ||
|
||
|
||
export default function RootLayout({ | ||
children, | ||
}: Readonly<{ | ||
|
@@ -22,9 +21,7 @@ export default function RootLayout({ | |
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/variable/pretendardvariable-dynamic-subset.min.css" | ||
/> | ||
</head> | ||
<body> | ||
{children} | ||
</body> | ||
<body>{children}</body> | ||
</html> | ||
); | ||
} |