From 8be2723476e7b3f1905446a2d7dce36c8c11cf60 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 5 Sep 2021 11:48:56 -0700 Subject: Add map padding --- modern/src/map/MapPadding.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 modern/src/map/MapPadding.js (limited to 'modern/src/map') diff --git a/modern/src/map/MapPadding.js b/modern/src/map/MapPadding.js new file mode 100644 index 00000000..cb165797 --- /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; -- cgit v1.2.3