added zoom for cover arts

This commit is contained in:
Pünkösd Marcell 2020-11-27 00:13:29 +01:00
parent 287bcd5135
commit c321ee99c5
2 changed files with 65 additions and 6 deletions

View File

@ -0,0 +1,53 @@
<template>
<div>
<b-modal id="expanded-image-holder" footerClass="border-0" centered :title="text" size="lg" v-model="expanded">
<template slot="modal-footer"><span/></template>
<div class="text-center">
<b-img-lazy blank-src="@/assets/music_placeholder.png"
:src="src"
id="the-image-itself-expanded"
/>
</div>
</b-modal>
<div @click="expanded = true" id="image-holder">
<b-img-lazy blank-src="@/assets/music_placeholder.png"
:src="src"
id="the-image-itself"
/>
</div>
</div>
</template>
<script>
export default {
name: "ExpandableImage",
props: {
src: String,
text: String
},
data() {
return {
expanded: false
}
}
}
</script>
<style scoped>
#image-holder {
cursor: zoom-in;
width: inherit;
}
#image-holder img {
width: inherit;
}
#the-image-itself-expanded {
max-width: 100%;
max-height: 100%;
}
</style>

View File

@ -14,10 +14,7 @@
<b-row v-else> <b-row v-else>
<b-col class="my-4"> <b-col class="my-4">
<div> <div>
<b-img-lazy blank-src="@/assets/music_placeholder.png" <expandable-image :src="songInfo.cover_url" id="cover-art" :text="coverArtTitle"/>
:src="songInfo.cover_url || '@/assets/music_placeholder.png'"
id="cover-art"
/>
</div> </div>
<div class="my-3"> <div class="my-3">
<p><b>Artist:</b> {{ songInfo.artist }} </p> <p><b>Artist:</b> {{ songInfo.artist }} </p>
@ -28,7 +25,7 @@
</div> </div>
<div class="my-3"> <div class="my-3">
<b-button :disabled="!songInfo.spotify_id" :href="spotifyLink" target="_blank">Open on Spotify!</b-button>&nbsp; <b-button :disabled="!songInfo.spotify_id" :href="spotifyLink" target="_blank">Open on Spotify!</b-button>&nbsp;
<b-button variant="success" :disabled="!songInfo.spotify_id" @click="startPlayer"><b-icon icon="play-fill"/> Play!</b-button> <b-button variant="success" :disabled="!songInfo.spotify_id" @click="startPlayer"><b-icon icon="play-fill"/> Play</b-button>
</div> </div>
</b-col> </b-col>
@ -38,11 +35,13 @@
<script> <script>
import BigChungusLoader from "@/components/BigChungusLoader"; import BigChungusLoader from "@/components/BigChungusLoader";
import ExpandableImage from "@/components/ExpandableImage";
export default { export default {
name: "Item", name: "Item",
components: { components: {
BigChungusLoader BigChungusLoader,
ExpandableImage
}, },
data() { data() {
return { return {
@ -75,6 +74,13 @@ export default {
} else { } else {
return ""; return "";
} }
},
coverArtTitle() {
// TODO: do better
if (this.songInfo.artist && this.songInfo.album ) {
return this.songInfo.artist + ' - ' + this.songInfo.album;
}
return this.songInfo.album || this.songInfo.artist || this.songInfo.title;
} }
}, },
filters: { filters: {