Tutorial Store Locator - Structure
by woosmap
HTML
<script src="https://sdk.woosmap.com/locator/loader.js"></script>
<div id="main">
<div id="my-map-container">
<div id="my-map">MAP</div>
</div>
<div id="sidebar-container">
<div id="sidebar">
<section id="listing-stores-container">
</section>
<section id="selected-store-container">
</section>
</div>
</div>
</div>
CSS
body {
font-size: 15px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}
#main {
display: flex;
position: absolute;
flex-direction: column;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
#my-map-container {
display: flex;
flex-grow: 0;
height: 55vh;
position: relative;
}
#my-map {
display: flex;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #CCC;
}
#sidebar-container {
display: flex;
flex-direction: column;
flex-shrink: 0;
flex-grow: 1;
flex-basis: 0;
position: relative;
z-index: 1;
overflow: hidden;
background-color: white;
box-shadow: 0 -2px 4px 0 rgba(0, 0, 0, 0.12);
}
#sidebar {
display: flex;
flex-direction: column;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
#listing-stores-container {
display: flex;
overflow: auto;
justify-content: space-between;
flex-direction: column;
position: relative;
background: rgba(255, 255, 255, 0.8);
}
.summary-store-card {
display: flex;
padding: .8rem 1.3rem;
cursor: pointer;
vertical-align: middle;
line-height: 1.7em;
border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.summary-store-card:hover {
background: #f0f0f0;
}
#selected-store-container {
display: none;
overflow: auto;
justify-content: space-between;
flex-direction: column;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
overflow: auto;
background: white;
}
.selected-store-card {
vertical-align: middle;
line-height: 2em;
}
.selected-store-card .hero {
padding: .8rem 1.4rem;
}
.selected-store-card .store-title {
font-size: 1.5rem;
}
.selected-store-card .content {
padding: 0 1.4rem .8rem;
color: #1D1D1D;
}
.store-address {
line-height: 1.6rem;
}
.selected-store-card .store-address,
.store-contact a,
.store-website a {
padding: .2em 0;
...
JavaScript
const woosmapLoadOptions = {
version: '1.4',
publicKey: 'woos-8b95bb95-8e0d-3e34-9d30-87e77e2e0d93', //replace with your public key
callback: woosmap_main,
loadJQuery: true
};
const woosmapOptions = {
style: {
'default': {
'icon': {
url: 'https://demo.woosmap.com/storelocator/images/markers/starbucks-marker.svg',
scaledSize: {
height: 47,
width: 40
},
},
'numberedIcon': {
url: 'https://demo.woosmap.com/storelocator/images/markers/starbucks-marker.svg',
scaledSize: {
height: 47,
width: 40
},
},
'selectedIcon': {
url: 'https://demo.woosmap.com/storelocator/images/markers/starbucks-marker-selected.svg',
scaledSize: {
height: 71,
width: 61
}
}
}
},
tileStyle: {
color: '#008248',
size: 15,
minSize: 4
},
breakPoint: 12
};
const googleLoadOptions = {
key: "AIzaSyCOtRab6Lh2pNn7gYxvAqN5leETC24OXYQ"
};
const googleMapsOptions = {
center: {
lat: 51.53,
lng: -0.185
},
zoom: 10
};
let selectedStoreObj;
const selectedStoreTemplate = "<div class='woosmap-tableview-cell'>" +
"<div class='store-photo-header'></div>" +
"<div class='selected-store-card'><div class='hero'>" +
"<div class='store-title'>{{name}}</div>" +
"{{#types}}<div class='store-types'>{{types}}</div>{{/types}}</div>" +
"<div class='content'><div class='store-address'>{{address.lines}}</div>" +
"{{#contact.phone}}<div class='store-contact'><a href='tel:{{contact.phone}}'>{{contact.phone}}</a></div>{{/contact.phone}}" +
"{{#contact.website}}<div class='store-website'><a href='{{contact.website}}' target='_blank'>Go to website</a></div>{{/contact.website}}" +
"</div></div>" +
"</div>";
const summaryStoreTemplate = "<div class='controls summary-store-card'><div>" +
"<div><strong>{{name}} - {{address.city}}</strong></div>" +
"<div><div...