Skip to content

Commit

Permalink
KAW-7683 maps component
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakshmishri committed Aug 12, 2024
1 parent a0be148 commit f9bd36b
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
13 changes: 13 additions & 0 deletions blocks/dealer-locator/dealer-locator.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.dealer-locator-map {
height: 400px;
position: relative;
overflow: hidden;
}

.dealer-locator.height-big .dealer-locator-map {
height: 600px;
}

.woosmap-slw-listview-desktop-partial {
display: none;
}
76 changes: 76 additions & 0 deletions blocks/dealer-locator/dealer-locator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { loadScript } from '../../scripts/aem.js';

export default async function decorate(block) {
const dealerLocator = document.createElement('div');
dealerLocator.classList.add('dealer-locator-map');
dealerLocator.setAttribute('id', 'dealer-locator');
block.append(dealerLocator);
loadScript('/blocks/dealer-locator/vendor/jquery.min.js', { type: 'text/javascript', charset: 'UTF-8' })
.then(() => {
// these scripts depend on jquery:
loadScript('//webapp.woosmap.com/webapp.js', { type: 'text/javascript' }).then(() => {
function loadWebApp() {
const publicKey = 'woos-50c04d89-af71-3a3b-b0b9-0786ee130532';
// eslint-disable-next-line no-undef
const webapp = new window.WebApp('dealer-locator', publicKey);
const config = {
maps: {
provider: 'woosmap',
channel: '',
localities: {
language: 'en',
data: 'advanced',
},
},
theme: {
primaryColor: '#008a2f',
},
datasource: {
maxResponses: 5,
maxDistance: 1000000,
useDistanceMatrix: true,
distanceMatrixProvider: 'woosmap',
},
internationalization: {
lang: 'en',
},
woosmapview: {
initialCenter: {
lat: 52.4862,
lng: 1.8904,
},
initialZoom: 5,
fitBounds: true,
tileStyle: {
color: '#ed1d24',
size: 12,
minSize: 10,
},
breakPoint: 10,
style: {
default: {
icon: {
url: 'https://www.kawasaki.eu/content/dam/dealerlocator/location-default-bimoto.png',
anchor: {
x: 16,
y: 16,
},
},
selectedIcon: {
url: 'https://www.kawasaki.eu/content/dam/dealerlocator/location-active-bimoto.png',
anchor: {
x: 16,
y: 16,
},
},
},
},
},
};
webapp.setConf(config);
webapp.render();
}
loadWebApp();
});
});
}
4 changes: 4 additions & 0 deletions blocks/dealer-locator/vendor/jquery.min.js

Large diffs are not rendered by default.

0 comments on commit f9bd36b

Please sign in to comment.