Added base restaurants and icons
This commit is contained in:
95
src/App.vue
95
src/App.vue
@@ -1,27 +1,110 @@
|
||||
<script setup lang="ts">
|
||||
import 'leaflet/dist/leaflet.css'
|
||||
import { LMap, LTileLayer } from '@vue-leaflet/vue-leaflet'
|
||||
import { ref } from 'vue'
|
||||
import 'vue-leaflet-markercluster/dist/style.css'
|
||||
|
||||
const zoom = ref(6)
|
||||
const center = ref([38, 139.69])
|
||||
import L, { type PointTuple } from 'leaflet'
|
||||
globalThis.L = L
|
||||
|
||||
import { LMap, LTileLayer, LMarker, LPopup, LIcon } from '@vue-leaflet/vue-leaflet'
|
||||
import { LMarkerClusterGroup } from 'vue-leaflet-markercluster'
|
||||
import { computed, ref } from 'vue'
|
||||
import { useReviewStore } from './stores/reviews'
|
||||
|
||||
const { markers } = useReviewStore()
|
||||
|
||||
const zoom = ref(7)
|
||||
const minZoom = 4
|
||||
const center = ref<PointTuple>([47.809376, -0.637207])
|
||||
|
||||
const iconSize = ref<PointTuple>([30, 30])
|
||||
const iconAnchor = computed<PointTuple>(() => [iconSize.value[0] / 2, iconSize.value[1]])
|
||||
const popupOffset = [0, iconSize.value[0] * -0.66]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main>
|
||||
<LMap ref="map" v-model:zoom="zoom" v-model:center="center" :useGlobalLeaflet="false">
|
||||
<LMap
|
||||
ref="map"
|
||||
:min-zoom
|
||||
v-model:zoom="zoom"
|
||||
v-model:center="center"
|
||||
:useGlobalLeaflet="true"
|
||||
>
|
||||
<LTileLayer
|
||||
url="https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/{z}/{x}/{y}{r}.png"
|
||||
layer-type="base"
|
||||
name="Stadia Maps Basemap"
|
||||
/>
|
||||
|
||||
<LMarkerClusterGroup :max-cluster-radius="25">
|
||||
<LMarker v-for="marker in markers" :key="marker.title" :lat-lng="marker.coords">
|
||||
<LPopup :options="{ offset: popupOffset, maxWidth: 500, minWidth: 180 }">
|
||||
<h2 class="font-bold text-[1.2em] leading-5">
|
||||
{{ marker.title }}
|
||||
</h2>
|
||||
{{ marker.reviews?.[0].grade }} / 20
|
||||
</LPopup>
|
||||
<LIcon v-if="marker.type === 'bar'" icon-url="/map/icons/bar.svg" :icon-size :icon-anchor />
|
||||
<LIcon v-if="marker.type === 'bakery'" icon-url="/map/icons/bakery.svg" :icon-size :icon-anchor />
|
||||
|
||||
<template v-else-if="marker.type === 'restaurant'">
|
||||
<LIcon v-if="marker.food === 'asian'" icon-url="/map/icons/asian.svg" :icon-size :icon-anchor />
|
||||
<LIcon v-else-if="marker.food === 'burgers'" icon-url="/map/icons/burgers.svg" :icon-size :icon-anchor />
|
||||
<!-- <LIcon v-else-if="marker.food === 'creperie'" icon-url="/map/icons/creperie.svg" :icon-size :icon-anchor /> -->
|
||||
<!-- <LIcon v-else-if="marker.food === 'eastern'" icon-url="/map/icons/eastern.svg" :icon-size :icon-anchor /> -->
|
||||
<!-- <LIcon v-else-if="marker.food === 'fast-food'" icon-url="/map/icons/fast-food.svg" :icon-size :icon-anchor /> -->
|
||||
<LIcon v-else-if="marker.food === 'italian'" icon-url="/map/icons/italian.svg" :icon-size :icon-anchor />
|
||||
<LIcon v-else-if="marker.food === 'seafood'" icon-url="/map/icons/seafood.svg" :icon-size :icon-anchor />
|
||||
<!-- <LIcon v-else-if="marker.food === 'street-food'" icon-url="/map/icons/street-food.svg" :icon-size :icon-anchor /> -->
|
||||
<LIcon v-else-if="marker.food === 'vegetarian'" icon-url="/map/icons/vegetarian.svg" :icon-size :icon-anchor />
|
||||
<LIcon v-else icon-url="/map/icons/restaurant.svg" :icon-size :icon-anchor />
|
||||
</template>
|
||||
</LMarker>
|
||||
</LMarkerClusterGroup>
|
||||
</LMap>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
<style lang="scss">
|
||||
main {
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.leaflet-marker-icon {
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 8px 1px var(--color-slate-800);
|
||||
}
|
||||
|
||||
.leaflet-popup-content-wrapper {
|
||||
border-radius: 5px;
|
||||
|
||||
.leaflet-popup-content {
|
||||
margin: 10px 20px 10px 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.marker-cluster-small {
|
||||
background-color: color-mix(in srgb, var(--color-green-500) 50%, transparent);
|
||||
|
||||
div {
|
||||
background-color: color-mix(in srgb, var(--color-green-500) 70%, transparent);
|
||||
}
|
||||
}
|
||||
|
||||
.marker-cluster-medium {
|
||||
background-color: color-mix(in srgb, var(--color-yellow-400) 50%, transparent);
|
||||
|
||||
div {
|
||||
background-color: color-mix(in srgb, var(--color-yellow-400) 70%, transparent);
|
||||
}
|
||||
}
|
||||
|
||||
.marker-cluster-large {
|
||||
background-color: color-mix(in srgb, var(--color-rose-400) 50%, transparent);
|
||||
|
||||
div {
|
||||
background-color: color-mix(in srgb, var(--color-rose-400) 70%, transparent);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user