Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 4b02827c

Přidáno uživatelem Václav Honzík před asi 3 roky(ů)

LeafletExample.tsx

Zobrazit rozdíly:

map_frameworks/package.json
9 9
    "@types/": "urbica/react-map-gl",
10 10
    "@types/dotenv": "^8.2.0",
11 11
    "@types/jest": "^27.0.1",
12
    "@types/leaflet": "^1.7.9",
12 13
    "@types/mapbox-gl": "^2.6.2",
13 14
    "@types/node": "^16.7.13",
14 15
    "@types/react": "^17.0.20",
15 16
    "@types/react-dom": "^17.0.9",
17
    "@types/react-leaflet": "^2.8.2",
16 18
    "@urbica/react-map-gl": "^1.14.4",
19
    "leaflet": "^1.7.1",
17 20
    "mapbox-gl": "^2.7.0",
18 21
    "pigeon-maps": "^0.20.0",
19 22
    "react": "^17.0.2",
20 23
    "react-dom": "^17.0.2",
24
    "react-leaflet": "^3.2.5",
21 25
    "react-router-dom": "^6.2.2",
22 26
    "react-scripts": "5.0.0",
23 27
    "typescript": "^4.4.2",
map_frameworks/public/index.html
16 16
      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
17 17
    -->
18 18
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json"/>
19
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
20
          integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
21
          crossorigin=""/>
19 22
    <!--
20 23
      Notice the use of %PUBLIC_URL% in the tags above.
21 24
      It will be replaced with the URL of the `public` folder during the build.
map_frameworks/src/App.tsx
2 2
import './App.css'
3 3
import MapBoxExample from './component/MapBoxExample'
4 4
import PigeonMapsExample from './component/PigeonMapsExample'
5
import LeafletExample from './component/LeafletExample'
5 6

  
6 7
const App = () => (
7 8
    <div className="App">
8 9
        <MapBoxExample/>
9 10
        <PigeonMapsExample/>
11
        <LeafletExample />
10 12
    </div>
11 13
)
12 14

  
map_frameworks/src/component/LeafletExample.tsx
1
// Wrapper around leaflet -> https://react-leaflet.js.org/docs/start-setup/
2
import { MapContainer, Marker, Popup, SVGOverlay, TileLayer } from 'react-leaflet'
3
import MapBoxExample from './MapBoxExample'
4

  
5
const LeafletExample = () => {
6

  
7
    return (
8
        <>
9
            <h1>Leaflet Example</h1>
10
            <MapContainer style={ { height: 450 } } center={ [51.505, -0.09] } zoom={ 13 }>
11
                <TileLayer
12
                    attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
13
                    url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
14
                />
15
                <Marker position={ [51.505, -0.09] }>
16
                    <Popup>
17
                        <MapBoxExample />
18
                    </Popup>
19
                </Marker>
20
            </MapContainer>
21
        </>
22
    )
23
}
24

  
25
export default LeafletExample

Také k dispozici: Unified diff