aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/MapPadding.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/map/MapPadding.js')
-rw-r--r--modern/src/map/MapPadding.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/modern/src/map/MapPadding.js b/modern/src/map/MapPadding.js
new file mode 100644
index 0000000..cb16579
--- /dev/null
+++ b/modern/src/map/MapPadding.js
@@ -0,0 +1,14 @@
+import { useEffect } from 'react';
+
+import { map } from './Map';
+
+const MapPadding = ({ top, right, bottom, left }) => {
+ useEffect(() => {
+ map.setPadding({ top, right, bottom, left });
+ return () => map.setPadding({ top: 0, right: 0, bottom: 0, left: 0 });
+ }, [top, right, bottom, left]);
+
+ return null;
+};
+
+export default MapPadding;