1- import { Control , CustomMarker , GoogleMap , useMapContext } from " react-google-map-wrapper" ;
1+ import { Control , CustomMarker , GoogleMap , useMapContext } from ' react-google-map-wrapper' ;
22
3- import { Container } from "../../Container" ;
3+ import { Container } from '../../Container' ;
4+ import { ControlButton } from '../../ControlButton' ;
45
56const center = { lat : 37.5111158 , lng : 127.098167 } ;
67
@@ -9,38 +10,21 @@ function MapContent() {
910
1011 const handleButtonClick = ( ) => {
1112 map . setCenter ( center ) ;
12- }
13+ } ;
1314
1415 return (
15- < Control position = { google . maps . ControlPosition . TOP_CENTER } >
16- < button style = { {
17- backgroundColor : '#fff' ,
18- border : '2px solid #fff' ,
19- borderRadius : '3px' ,
20- boxShadow : '0 2px 6px rgba(0,0,0,.3)' ,
21- color : 'rgb(25,25,25)' ,
22- cursor : 'pointer' ,
23- fontFamily : 'Roboto,Arial,sans-serif' ,
24- fontSize : '16px' ,
25- lineHeight : '38px' ,
26- margin : '8px 0 22px' ,
27- padding : '0 5px' ,
28- textAlign : 'center' ,
29- } } onClick = { handleButtonClick } > Center Map</ button >
16+ < Control className = 'm-[10px]' position = { google . maps . ControlPosition . TOP_CENTER } >
17+ < ControlButton onClick = { handleButtonClick } > Center Map</ ControlButton >
3018 </ Control >
3119 ) ;
3220}
3321
3422export function ControlEx ( ) {
3523 return (
3624 < Container >
37- < GoogleMap
38- className = 'h-[400px]'
39- zoom = { 12 }
40- center = { center }
41- >
25+ < GoogleMap className = 'h-[400px]' zoom = { 12 } center = { center } >
4226 < MapContent />
4327 </ GoogleMap >
4428 </ Container >
45- )
29+ ) ;
4630}
0 commit comments