diff --git a/.github/workflows/test.build.lib.yml b/.github/workflows/test.build.lib.yml index 00e82f3b..99b3cd50 100644 --- a/.github/workflows/test.build.lib.yml +++ b/.github/workflows/test.build.lib.yml @@ -37,7 +37,7 @@ jobs: build-examples: if: needs.files-changed.outputs.build == 'true' name: Test Example Apps - needs: [build, files-changed] + needs: [files-changed, build] runs-on: ubuntu-latest strategy: matrix: diff --git a/app/src/pages/MapContainer.tsx b/app/src/pages/MapContainer.tsx index 14d96c71..fe3140a1 100644 --- a/app/src/pages/MapContainer.tsx +++ b/app/src/pages/MapContainer.tsx @@ -84,6 +84,8 @@ function MapContainer({ layers, map }: { layers: LayerProps[]; map: any }) { defaultTheme={map.default_theme} showZoomControl={map.show_zoom_control} expandLayerControl={map.expand_layer_control} + tileServerUrl={map.tile_server_url} + tileServerAttribution={map.tile_server_attribution} > {layers && apis && diff --git a/lib/src/Components/Map/UtopiaMap.tsx b/lib/src/Components/Map/UtopiaMap.tsx index da909e3b..3ca2a6e3 100644 --- a/lib/src/Components/Map/UtopiaMap.tsx +++ b/lib/src/Components/Map/UtopiaMap.tsx @@ -56,6 +56,8 @@ function UtopiaMap({ defaultTheme, donationWidget, expandLayerControl, + tileServerUrl, + tileServerAttribution, }: { /** height of the map (default '500px') */ height?: string @@ -85,6 +87,10 @@ function UtopiaMap({ donationWidget?: boolean /** open layer control on map initialisation */ expandLayerControl?: boolean + /** configure a custom tile server */ + tileServerUrl?: string + /** configure a custom tile server attribution */ + tileServerAttribution?: string }) { return ( @@ -104,6 +110,8 @@ function UtopiaMap({ showThemeControl={showThemeControl} defaultTheme={defaultTheme} expandLayerControl={expandLayerControl} + tileServerUrl={tileServerUrl} + tileServerAttribution={tileServerAttribution} > {children} diff --git a/lib/src/Components/Map/UtopiaMapInner.tsx b/lib/src/Components/Map/UtopiaMapInner.tsx index ba7f02cc..d197f92a 100644 --- a/lib/src/Components/Map/UtopiaMapInner.tsx +++ b/lib/src/Components/Map/UtopiaMapInner.tsx @@ -55,6 +55,8 @@ export function UtopiaMapInner({ defaultTheme = '', donationWidget, expandLayerControl, + tileServerUrl, + tileServerAttribution, }: { children?: React.ReactNode geo?: GeoJsonObject @@ -65,6 +67,8 @@ export function UtopiaMapInner({ showThemeControl?: boolean defaultTheme?: string expandLayerControl?: boolean + tileServerUrl?: string + tileServerAttribution?: string }) { const selectNewItemPosition = useSelectPosition() const setSelectNewItemPosition = useSetSelectPosition() @@ -278,8 +282,11 @@ export function UtopiaMapInner({ OpenStreetMap' + } + url={tileServerUrl ?? 'https://tile.osmand.net/hd/{z}/{x}/{y}.png'} /> setClusterRef(r as any)} diff --git a/lib/src/assets/css/leaflet.css b/lib/src/assets/css/leaflet.css index d8fab67f..af2364c1 100644 --- a/lib/src/assets/css/leaflet.css +++ b/lib/src/assets/css/leaflet.css @@ -1,6 +1,29 @@ - .leaflet-control-attribution { - display: none; + .leaflet-control-attribution{ + color: #000 !important; + background-color: white/50 !important; + border-radius: 4px; + padding: 0 4px; + z-index: 400 !important; + font-size: 10px; + opacity: 0.5; +} + + .leaflet-control-attribution a{ + color: #000 !important; } + + .leaflet-attribution-flag { +display: none !important; + } + + .leaflet-control-attribution a:not([href*="openstreetmap"]) { + display: none !important; + } + + /* 2) Entfernt den Trenner “|” (liegt im span[aria-hidden]) */ + .leaflet-control-attribution span[aria-hidden="true"] { + display: none !important; + } .leaflet-control-locate { display: none; diff --git a/lib/src/types/UtopiaMapProps.d.ts b/lib/src/types/UtopiaMapProps.d.ts index 3d85374e..b5aec550 100644 --- a/lib/src/types/UtopiaMapProps.d.ts +++ b/lib/src/types/UtopiaMapProps.d.ts @@ -18,4 +18,6 @@ export interface UtopiaMapProps { donationWidget?: boolean defaultTheme?: string expandLayerControl?: boolean + tileServerUrl?: string + tileServerAttribution?: string }