2021-09-20 12:18:40 +02:00
|
|
|
<template>
|
2021-10-05 15:23:41 +02:00
|
|
|
<div class="static-map" :class="{ 'display-hover': displayHover }">
|
2021-11-03 08:52:03 +01:00
|
|
|
<img v-if="displayHover" :src="imageUrl" alt="" />
|
2021-09-22 11:49:56 +02:00
|
|
|
<div
|
2021-10-05 15:23:41 +02:00
|
|
|
v-else
|
2021-09-22 11:49:56 +02:00
|
|
|
class="bg-map-image"
|
|
|
|
:style="{
|
2021-11-03 08:52:03 +01:00
|
|
|
backgroundImage: `url(${imageUrl})`,
|
2021-09-22 11:49:56 +02:00
|
|
|
}"
|
2021-09-20 12:18:40 +02:00
|
|
|
/>
|
|
|
|
<div class="map-attribution">
|
|
|
|
<span class="map-attribution-text">©</span>
|
|
|
|
<a
|
|
|
|
class="map-attribution-text"
|
2021-10-02 16:16:58 +02:00
|
|
|
href="https://www.openstreetmap.org/copyright"
|
2021-09-20 12:18:40 +02:00
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
OpenStreetMap
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2021-11-10 21:19:27 +01:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { toRefs, withDefaults } from 'vue'
|
2021-09-20 12:18:40 +02:00
|
|
|
|
|
|
|
import { IWorkout } from '@/types/workouts'
|
|
|
|
import { getApiUrl } from '@/utils'
|
|
|
|
|
2021-11-10 21:19:27 +01:00
|
|
|
interface Props {
|
|
|
|
workout: IWorkout
|
|
|
|
displayHover?: boolean
|
|
|
|
}
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
|
|
displayHover: false,
|
2021-09-20 12:18:40 +02:00
|
|
|
})
|
2021-11-10 21:19:27 +01:00
|
|
|
const { displayHover } = toRefs(props)
|
|
|
|
const imageUrl = `${getApiUrl()}workouts/map/${props.workout.map}`
|
2021-09-20 12:18:40 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.static-map {
|
|
|
|
display: flex;
|
|
|
|
position: relative;
|
|
|
|
|
2021-10-05 15:23:41 +02:00
|
|
|
&.display-hover {
|
|
|
|
position: absolute;
|
|
|
|
margin-left: 20px;
|
2021-10-05 20:05:07 +02:00
|
|
|
margin-top: 3px;
|
2021-10-05 15:23:41 +02:00
|
|
|
width: 400px;
|
2021-10-05 20:05:07 +02:00
|
|
|
height: 225px;
|
2021-10-05 15:23:41 +02:00
|
|
|
z-index: 100;
|
|
|
|
}
|
|
|
|
|
2021-09-22 11:49:56 +02:00
|
|
|
.bg-map-image {
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
|
|
|
opacity: 0.6;
|
|
|
|
height: 200px;
|
|
|
|
width: 100%;
|
2021-09-20 12:18:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.map-attribution {
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
font-size: 11px;
|
|
|
|
position: absolute;
|
|
|
|
}
|
|
|
|
|
|
|
|
.map-attribution-text {
|
|
|
|
background-color: rgba(255, 255, 255, 0.7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|