summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2022-08-29 17:40:28 +0300
committerYuval Adam <_@yuv.al>2022-08-29 17:40:28 +0300
commit3fc385b31671d5f84c066c2c6a567bb68a83a8b7 (patch)
treee8431bf25bf1c0a5e837d28c57724ed0893a3b02
parent726393779822333d04d76a2c7fb5c9e121fb830f (diff)
Mapbox base layer and loading works
-rw-r--r--src/Map.tsx25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/Map.tsx b/src/Map.tsx
index 011d5c8..76b1f11 100644
--- a/src/Map.tsx
+++ b/src/Map.tsx
@@ -1,6 +1,6 @@
-import React, { Fragment, useState, useEffect, useRef } from "react";
+import React, { useState, useEffect, useRef } from "react";
// @ts-ignore
-import { mapboxgl, LngLatLike } from '!mapbox-gl'; // eslint-disable-line import/no-webpack-loader-syntax
+import mapboxgl from '!mapbox-gl'; // eslint-disable-line import/no-webpack-loader-syntax
import {
MAPBOX_ACCESS_TOKEN,
@@ -18,15 +18,15 @@ interface MapProps {
function Map({ slider, images }: MapProps) {
const mapContainer = useRef(null);
const map = useRef(null);
- const [center] = useState<LngLatLike>([35, 31.9]);
+ const [center] = useState<mapboxgl.LngLatLike>([35, 31.9]);
const [zoom] = useState([6.3]);
useEffect(() => {
if (map.current) return; // initialize map only once
- map.current = new mapboxgl({
+ map.current = new mapboxgl.Map({
accessToken: MAPBOX_ACCESS_TOKEN,
container: mapContainer.current,
- style: 'mapbox://styles/mapbox/streets-v11',
+ style: "mapbox://styles/mapbox/dark-v9",
center,
zoom,
minZoom: 5,
@@ -37,20 +37,15 @@ function Map({ slider, images }: MapProps) {
return (
<div>
- <div ref={mapContainer} className="map-container" />
+ <div ref={mapContainer} className="map-container" style={{
+ height: "100vh",
+ width: "100vw"
+ }} />
</div>
);
// return (
- // <Mapbox
- // style="mapbox://styles/mapbox/dark-v9"
- // center={center}
- // zoom={zoom}
- // containerStyle={{
- // height: "100vh",
- // width: "100vw"
- // }}
- // >
+ // <Mapbox >
// {images.map((img, i) => {
// const id = `radar-280-${i}`;
// return (