digitransit-ui/app/component/map/tile-layer/VectorTileLayerContainer.js
Vesa Meskanen 4d395f736a fix: simplify map props
No need to declare props which are just passed to child components
2026-02-11 19:35:57 +02:00

50 lines
1.3 KiB
JavaScript

import React from 'react';
import { configShape } from '../../../util/shapes';
import TileLayerContainer from './TileLayerContainer';
import VehicleRentalStations from './VehicleRentalStations';
import Stops from './Stops';
import ParkAndRideForCars from './ParkAndRideForCars';
import ParkAndRideForBikes from './ParkAndRideForBikes';
import { mapLayerShape } from '../../../store/MapLayerStore';
import RentalVehicles from './RentalVehicles';
export default function VectorTileLayerContainer(
{ mapLayers, ...rest },
{ config },
) {
const layers = [];
layers.push(Stops);
if (mapLayers.citybike) {
layers.push(VehicleRentalStations);
}
if (mapLayers.parkAndRide) {
layers.push(ParkAndRideForCars);
}
if (mapLayers.parkAndRideForBikes) {
layers.push(ParkAndRideForBikes);
}
if (mapLayers.scooter) {
layers.push(RentalVehicles);
}
return (
<TileLayerContainer
key="tileLayer"
pane="markerPane"
layers={layers}
mapLayers={mapLayers}
tileSize={config.map.tileSize || 256}
zoomOffset={config.map.zoomOffset || 0}
{...rest}
/>
);
}
VectorTileLayerContainer.propTypes = {
mapLayers: mapLayerShape.isRequired,
};
VectorTileLayerContainer.contextTypes = {
config: configShape.isRequired,
};