Skip to content

Commit 4f28a10

Browse files
committed
style: with attribution
1 parent fb0beb3 commit 4f28a10

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/components/MapContainer.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ export interface IMapContainer {
1010
readonly zoom?: number;
1111
readonly minZoom: number;
1212
readonly maxZoom: number;
13-
readonly tile: string;
13+
readonly tileSrc: {
14+
readonly url: string;
15+
readonly attribution: string;
16+
};
1417
readonly coordinates: number[];
1518
readonly scrollWheelZoom?: boolean;
1619
readonly zoomControl?: boolean;
@@ -24,7 +27,7 @@ export const MapContainer = ({
2427
minZoom,
2528
maxZoom,
2629
zoom,
27-
tile,
30+
tileSrc,
2831
borderRadius = '8px',
2932
coordinates,
3033
scrollWheelZoom,
@@ -78,15 +81,14 @@ export const MapContainer = ({
7881
zoom={zoom ?? 6}
7982
scrollWheelZoom={scrollWheelZoom}
8083
zoomControl={zoomControl}
81-
attributionControl={false}
8284
doubleClickZoom={false}
8385
dragging={dragging}
8486
maxZoom={maxZoom}
8587
minZoom={minZoom}
8688
center={[latitude, longitude]}
8789
style={{ cursor: 'default', borderRadius, height }}
8890
>
89-
<TileLayer url={tile} />
91+
<TileLayer url={tileSrc.url} attribution={tileSrc.attribution} />
9092
<Marker position={[latitude, longitude]} icon={icon} />
9193
</MapBox>
9294
);

src/schemas/location.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ export const Location = ({ onCreate, onUpdate }: ISchema) => {
100100
scrollWheelZoom
101101
height={200}
102102
onClick={handleMapClick}
103-
tile="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
103+
tileSrc={{
104+
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
105+
attribution: '&copy; OpenStreetMap contributors'
106+
}}
104107
minZoom={1}
105108
maxZoom={18}
106109
coordinates={[currentConfig.latitude, currentConfig.longitude]}

0 commit comments

Comments
 (0)