From 6b7e7b5271bd000470005267b6061df409485c1c Mon Sep 17 00:00:00 2001 From: GabrielTrettel Date: Thu, 24 Jun 2021 20:28:53 -0300 Subject: [PATCH] Setting html from string --- src/app/components/map/Map.js | 114 ++++++++++++++++++++++++ src/app/components/map/OpenStreetMap.js | 11 ++- 2 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 src/app/components/map/Map.js diff --git a/src/app/components/map/Map.js b/src/app/components/map/Map.js new file mode 100644 index 0000000..337e94d --- /dev/null +++ b/src/app/components/map/Map.js @@ -0,0 +1,114 @@ +export default html_content = ` + + + + Mobile tutorial - Leaflet + + + + + + + + + + + + + + + +
+ + + +`; diff --git a/src/app/components/map/OpenStreetMap.js b/src/app/components/map/OpenStreetMap.js index a93bfa3..597f6b5 100644 --- a/src/app/components/map/OpenStreetMap.js +++ b/src/app/components/map/OpenStreetMap.js @@ -9,6 +9,8 @@ import { } from "./LeafLetMap"; import MapModal from "../MapModal"; import { useLocation, getLocation } from "../../hooks/useLocation"; +import html_content from "./Map.js"; + function bindEventsToListeners( event, @@ -41,7 +43,8 @@ export default function OpenStreetMap({ moveEndListener, }) { const [mapRef, setMapRef] = useState(null); - const [webviewContent, setWebviewContent] = useState(null); + // const [webviewContent, setWebviewContent] = useState(null); + const webviewContent = html_content; const [markerListener, setMarkerListener] = useState(null); const viewFunction = `\ @@ -55,9 +58,9 @@ export default function OpenStreetMap({ insertMarker(mapRef, val.ID, val.coordinate, val.image); }); - loadHTMLFile() - .then((html) => setWebviewContent(html)) - .catch((e) => console.warn(e)); + // loadHTMLFile() + // .then((html) => setWebviewContent(html)) + // .catch((e) => console.warn(e)); return (