mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
Zone collection + creation
Zone create UI flow
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import * as React from "react";
|
||||
|
||||
import L, { LatLngLiteral } from "leaflet";
|
||||
import "leaflet-defaulticon-compatibility";
|
||||
import "leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css";
|
||||
import "leaflet/dist/leaflet.css";
|
||||
import { FeatureGroup, GeoJSON, MapContainer, TileLayer } from "react-leaflet";
|
||||
|
||||
import { MapEvents } from "@/components/MapEvents";
|
||||
import type { ZoneModel } from "@/server/models/zoneModel";
|
||||
|
||||
const center: LatLngLiteral = { lat: 47.0844, lng: 2.3964 };
|
||||
|
||||
export type ZoneThumbnailProps = {
|
||||
features: ZoneModel["features"];
|
||||
size: number;
|
||||
};
|
||||
|
||||
export const ZoneThumbnail = ({ features, size }: ZoneThumbnailProps) => {
|
||||
return (
|
||||
<MapContainer
|
||||
center={center}
|
||||
zoom={5}
|
||||
zoomControl={false}
|
||||
scrollWheelZoom={false}
|
||||
dragging={false}
|
||||
style={{ height: size, width: size }}
|
||||
attributionControl={false}
|
||||
>
|
||||
<MapEvents bounds={L.geoJson(features).getBounds()} />
|
||||
<TileLayer
|
||||
attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
||||
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
/>
|
||||
|
||||
<GeoJSON data={features} />
|
||||
</MapContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default ZoneThumbnail;
|
||||
Reference in New Issue
Block a user