Skip to content

Commit cb25dcd

Browse files
committed
Fix scrolling behavior in examples
1 parent 5ce2776 commit cb25dcd

File tree

6 files changed

+43
-41
lines changed

6 files changed

+43
-41
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React, { useState, Fragment } from 'react';
2+
import Map from '../../src/index';
3+
import CustomOverlay from '../../src/components/CustomOverlay';
4+
import styles from './withCustomOverlay.module.css';
5+
6+
const WithCustomOverlay = (props) => {
7+
const [showOverlay, setShowOverlay] = useState(true);
8+
if (!props.loaded) return <div>Loading...</div>;
9+
10+
return (
11+
<Fragment>
12+
<button
13+
className={styles.button}
14+
onClick={() => setShowOverlay(!showOverlay)}
15+
>
16+
Toggle Popup
17+
</button>
18+
<Map google={props.google} className="map" zoom={14}>
19+
<CustomOverlay
20+
position={{ lat: 37.782551, lng: -122.425368 }}
21+
visible={showOverlay}
22+
>
23+
<div className={styles.overlayContainer}>
24+
Hi there. I'm a custom overlay.
25+
</div>
26+
</CustomOverlay>
27+
</Map>
28+
</Fragment>
29+
);
30+
};
31+
32+
export default WithCustomOverlay;

examples/components/withCustomPopup.module.css renamed to examples/components/withCustomOverlay.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.customPopup {
1+
.overlayContainer {
22
background-color: white;
33
padding: 20px;
44
border-radius: 10px;

examples/components/withCustomPopup.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

examples/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Polygon from './components/withPolygons';
2121
import Polyline from './components/withPolylines';
2222
import Rectangle from './components/withRectangle';
2323
import CustomEvents from './components/resizeEvent';
24-
import CustomPopup from './components/withCustomPopup';
24+
import CustomOverlay from './components/withCustomOverlay';
2525

2626
const routes = [
2727
{
@@ -76,8 +76,8 @@ const routes = [
7676
},
7777
{
7878
path: '/onCustomPopup',
79-
name: 'Custom popup',
80-
component: CustomPopup
79+
name: 'Custom overlay',
80+
component: CustomOverlay
8181
}
8282
];
8383

examples/styles.module.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,12 @@ html, body {
6464
order: 2;
6565
position: relative;
6666
min-height: 100%;
67+
display: flex;
68+
flex-direction: column;
69+
70+
.mapContainer {
71+
flex: 1;
72+
position: relative;
73+
}
6774
}
6875
}
File renamed without changes.

0 commit comments

Comments
 (0)