diff --git a/components/src/maplibre/MapStyle/SWRDataLabDark.stories.svelte b/components/src/maplibre/MapStyle/SWRDataLabDark.stories.svelte index ef4fdf93..9d41afd1 100644 --- a/components/src/maplibre/MapStyle/SWRDataLabDark.stories.svelte +++ b/components/src/maplibre/MapStyle/SWRDataLabDark.stories.svelte @@ -30,6 +30,21 @@ + + +
+
+ + + +
+
+
+
diff --git a/components/src/maplibre/MapStyle/SWRDataLabDark.ts b/components/src/maplibre/MapStyle/SWRDataLabDark.ts index cb9cfe1a..9f6e747a 100644 --- a/components/src/maplibre/MapStyle/SWRDataLabDark.ts +++ b/components/src/maplibre/MapStyle/SWRDataLabDark.ts @@ -7,6 +7,7 @@ import makeTransit from './components/Transit'; import makePlaceLabels from './components/PlaceLabels'; import makeWalking from './components/Walking'; import makeRoads from './components/Roads'; +import type { StyleOptions } from './types'; const tokens = { sans_regular: ['SWR Sans Regular'], @@ -49,10 +50,6 @@ const { walkingLabels, walkingTunnels, walkingSurface, walkingBridges } = makeWa const { roadLabels, roadBridges, roadSurface, roadTunnels } = makeRoads(tokens); const { buildingFootprints, buildingExtrusions, structureExtrusions } = makeBuildings(tokens); -interface StyleOptions { - enableBuildingExtrusions?: boolean; -} - interface styleFunction { (options?: StyleOptions): StyleSpecification; } @@ -60,6 +57,9 @@ interface styleFunction { const style: styleFunction = (opts) => { const options = { enableBuildingExtrusions: false, + roads: { + showLabels: true + }, ...opts } as StyleOptions; @@ -127,7 +127,7 @@ const style: styleFunction = (opts) => { // 7. Labels ...walkingLabels, - ...roadLabels, + ...(options.roads?.showLabels ? roadLabels : []), // 8. Building extrusions ...(options.enableBuildingExtrusions ? [buildingExtrusions] : []), diff --git a/components/src/maplibre/MapStyle/SWRDataLabLight.mdx b/components/src/maplibre/MapStyle/SWRDataLabLight.mdx index 6a502c5e..4c66b524 100644 --- a/components/src/maplibre/MapStyle/SWRDataLabLight.mdx +++ b/components/src/maplibre/MapStyle/SWRDataLabLight.mdx @@ -82,6 +82,10 @@ Call `SWRDataLabLight()` to construct a style document and pass the result to th ```ts interface StyleOptions { enableBuildingExtrusions?: boolean; + roads?: { + showLabels?: boolean + } + } ``` diff --git a/components/src/maplibre/MapStyle/SWRDataLabLight.ts b/components/src/maplibre/MapStyle/SWRDataLabLight.ts index 0e666aee..b78845ca 100644 --- a/components/src/maplibre/MapStyle/SWRDataLabLight.ts +++ b/components/src/maplibre/MapStyle/SWRDataLabLight.ts @@ -7,6 +7,7 @@ import makeTransit from './components/Transit'; import makePlaceLabels from './components/PlaceLabels'; import makeWalking from './components/Walking'; import makeRoads from './components/Roads'; +import type { StyleOptions } from './types'; const tokens = { sans_regular: ['SWR Sans Regular'], @@ -49,10 +50,6 @@ const { walkingLabels, walkingTunnels, walkingSurface, walkingBridges } = makeWa const { roadLabels, roadBridges, roadSurface, roadTunnels } = makeRoads(tokens); const { buildingFootprints, buildingExtrusions, structureExtrusions } = makeBuildings(tokens); -interface StyleOptions { - enableBuildingExtrusions?: boolean; -} - interface styleFunction { (options?: StyleOptions): StyleSpecification; } diff --git a/components/src/maplibre/MapStyle/types.ts b/components/src/maplibre/MapStyle/types.ts new file mode 100644 index 00000000..34038225 --- /dev/null +++ b/components/src/maplibre/MapStyle/types.ts @@ -0,0 +1,8 @@ +interface StyleOptions { + enableBuildingExtrusions?: boolean; + roads?: { + showLabels?: boolean; + }; +} + +export type { StyleOptions };