Skip to content

Commit 5d0fd00

Browse files
committed
docs: add content
1 parent 3e76ceb commit 5d0fd00

File tree

17 files changed

+1254
-43
lines changed

17 files changed

+1254
-43
lines changed

docs/astro.config.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,29 +60,29 @@ export default defineConfig({
6060
link: '/docs/api/control',
6161
},
6262
{
63-
label: 'InfoWindow 🛠',
63+
label: 'InfoWindow',
6464
link: '/docs/api/info-window',
6565
},
6666
{
67-
label: 'Polyline 🛠',
67+
label: 'Polyline',
6868
link: '/docs/api/polyline',
6969
},
7070
{
71-
label: 'Polygon 🛠',
71+
label: 'Polygon',
7272
link: '/docs/api/polygon',
7373
},
7474
{
75-
label: 'Rectangle 🛠',
75+
label: 'Rectangle',
7676
link: '/docs/api/rectangle',
7777
},
7878
{
79-
label: 'Circle 🛠',
79+
label: 'Circle',
8080
link: '/docs/api/circle',
8181
},
8282
{
83-
label: 'HeatmapLayer 🛠',
83+
label: 'HeatmapLayer',
8484
link: '/docs/api/heatmap-layer',
85-
}
85+
},
8686
],
8787
},
8888
{

docs/package-lock.json

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"astro": "^4.0.1",
2020
"react": "^18.2.0",
2121
"react-dom": "^18.2.0",
22-
"react-google-map-wrapper": "^0.0.1-beta.7",
22+
"react-google-map-wrapper": "^0.0.1-beta.9",
2323
"sharp": "^0.32.5",
2424
"tailwindcss": "^3.3.6",
2525
"typescript": "^5.3.3"

docs/src/components/ControlButton.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { HTMLAttributes } from 'react';
2+
3+
export function ControlButton(props: HTMLAttributes<HTMLButtonElement>) {
4+
return (
5+
<button
6+
className='h-[40px] bg-white rounded-[3px] text-[rgb(25,25,25)] cursor-pointer text-base m-[8xp_0_22px] p-[8px_17px] text-center'
7+
{...props}
8+
/>
9+
);
10+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { GoogleMap, Circle } from "react-google-map-wrapper";
2+
3+
import { Container } from "../../Container";
4+
5+
const cityList = [
6+
{
7+
name: 'chicago',
8+
center: { lat: 41.878, lng: -87.629 },
9+
population: 2714856,
10+
},
11+
{
12+
name: 'newyork',
13+
center: { lat: 40.714, lng: -74.005 },
14+
population: 8405837,
15+
},
16+
{
17+
name: 'losangeles',
18+
center: { lat: 34.052, lng: -118.243 },
19+
population: 3857799,
20+
},
21+
{
22+
name: 'vancouver',
23+
center: { lat: 49.25, lng: -123.1 },
24+
population: 603502,
25+
},
26+
];
27+
28+
export function CircleEx() {
29+
return (
30+
<Container>
31+
<GoogleMap
32+
className='h-[400px]'
33+
initialZoom={4}
34+
initialCenter={{ lat: 37.09, lng: -95.712 }}
35+
mapOptions={{
36+
mapTypeId: "terrain",
37+
}}
38+
>
39+
{cityList.map(({ name, center, population }) => (
40+
<Circle
41+
key={name}
42+
strokeColor="#FF0000"
43+
strokeOpacity={0.8}
44+
strokeWeight={2}
45+
fillColor="#FF0000"
46+
fillOpacity={0.35}
47+
center={center}
48+
radius={Math.sqrt(population) * 100}
49+
/>
50+
))}
51+
</GoogleMap>
52+
</Container>
53+
);
54+
}
Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
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

56
const 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

3422
export 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

Comments
 (0)