Skip to content

Commit 0245d88

Browse files
Replace @defra/defra-map with @defra/interactive-map
1 parent b4b4f0a commit 0245d88

3 files changed

Lines changed: 46 additions & 45 deletions

File tree

package-lock.json

Lines changed: 36 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@
7070
},
7171
"license": "SEE LICENSE IN LICENSE",
7272
"dependencies": {
73-
"@defra/defra-map": "github:DEFRA/interactive-map#forms-stable",
7473
"@defra/forms-model": "^3.0.603",
7574
"@defra/hapi-tracing": "^1.29.0",
75+
"@defra/interactive-map": "^0.0.2-alpha",
7676
"@elastic/ecs-pino-format": "^1.5.0",
7777
"@hapi/boom": "^10.0.1",
7878
"@hapi/catbox": "^12.1.1",

src/client/javascripts/location-map.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function initMaps(config = {}) {
108108
} = config
109109
const locations = document.querySelectorAll('.app-location-field')
110110

111-
// TODO: Fix this in `defra-map`
111+
// TODO: Fix this in `interactive-map`
112112
// If there are location components on the page fix up the main form submit
113113
// handler so it doesn't fire when using the integrated map search feature
114114
if (locations.length) {
@@ -268,7 +268,7 @@ function createMap(mapId, initConfig, mapsConfig) {
268268
const defra = window.defra
269269

270270
/** @type {DefraMap} */
271-
const map = new defra.DefraMap(mapId, {
271+
const map = new defra.InteractiveMap(mapId, {
272272
...initConfig,
273273
mapProvider: defra.maplibreProvider(),
274274
reverseGeocodeProvider: defra.openNamesProvider({
@@ -278,6 +278,7 @@ function createMap(mapId, initConfig, mapsConfig) {
278278
minZoom: 6,
279279
maxZoom: 18,
280280
containerHeight: '400px',
281+
enableZoomControls: true,
281282
transformRequest: makeTileRequestTransformer(apiPath),
282283
plugins: [
283284
defra.mapStylesPlugin({
@@ -286,8 +287,8 @@ function createMap(mapId, initConfig, mapsConfig) {
286287
id: 'outdoor',
287288
label: 'Outdoor',
288289
url: data.VTS_OUTDOOR_URL,
289-
thumbnail: `${assetPath}/defra-map/assets/images/outdoor-map-thumb.jpg`,
290-
logo: `${assetPath}/defra-map/assets/images/os-logo.svg`,
290+
thumbnail: `${assetPath}/interactive-map/assets/images/outdoor-map-thumb.jpg`,
291+
logo: `${assetPath}/interactive-map/assets/images/os-logo.svg`,
291292
logoAltText,
292293
attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`,
293294
backgroundColor: '#f5f5f0'
@@ -298,17 +299,17 @@ function createMap(mapId, initConfig, mapsConfig) {
298299
url: data.VTS_DARK_URL,
299300
mapColorScheme: 'dark',
300301
appColorScheme: 'dark',
301-
thumbnail: `${assetPath}/defra-map/assets/images/dark-map-thumb.jpg`,
302-
logo: `${assetPath}/defra-map/assets/images/os-logo-white.svg`,
302+
thumbnail: `${assetPath}/interactive-map/assets/images/dark-map-thumb.jpg`,
303+
logo: `${assetPath}/interactive-map/assets/images/os-logo-white.svg`,
303304
logoAltText,
304305
attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`
305306
},
306307
{
307308
id: 'black-and-white',
308309
label: 'Black/White',
309310
url: data.VTS_BLACK_AND_WHITE_URL,
310-
thumbnail: `${assetPath}/defra-map/assets/images/black-and-white-map-thumb.jpg`,
311-
logo: `${assetPath}/defra-map/assets/images/os-logo-black.svg`,
311+
thumbnail: `${assetPath}/interactive-map/assets/images/black-and-white-map-thumb.jpg`,
312+
logo: `${assetPath}/interactive-map/assets/images/os-logo-black.svg`,
312313
logoAltText,
313314
attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`
314315
}
@@ -325,7 +326,6 @@ function createMap(mapId, initConfig, mapsConfig) {
325326
width: '300px',
326327
showMarker: false
327328
}),
328-
defra.zoomControlsPlugin(),
329329
defra.scaleBarPlugin({
330330
units: 'metric'
331331
})

0 commit comments

Comments
 (0)