Add buttons to the cover art

This commit is contained in:
wvffle 2022-11-03 23:32:19 +00:00 committed by Kasper Seweryn
parent 5eff89920a
commit 8306eaaff6
3 changed files with 64 additions and 29 deletions

View File

@ -147,6 +147,13 @@ const hideArtist = () => {
}) })
} }
} }
enum CoverType {
COVER_ART,
MILK_DROP
}
const coverType = ref(CoverType.COVER_ART)
</script> </script>
<template> <template>
@ -165,12 +172,19 @@ const hideArtist = () => {
<template v-if="currentTrack"> <template v-if="currentTrack">
<div class="cover-container"> <div class="cover-container">
<div class="cover"> <div class="cover">
<milk-drop />
<img <img
v-if="coverType === CoverType.COVER_ART"
ref="cover" ref="cover"
alt="" alt=""
:src="$store.getters['instance/absoluteUrl'](currentTrack.coverUrl)" :src="$store.getters['instance/absoluteUrl'](currentTrack.coverUrl)"
> >
<milk-drop v-else-if="coverType === CoverType.MILK_DROP" />
<div class="cover-buttons">
<button class="ui secondary button">
<i class="icon ellipsis vertical" />
</button>
</div>
</div> </div>
</div> </div>
<h1 class="ui header"> <h1 class="ui header">

View File

@ -36,6 +36,8 @@ onScopeDispose(() => {
ref="canvas" ref="canvas"
@click="loadRandomPreset()" @click="loadRandomPreset()"
/> />
<Teleport to=".cover > .cover-buttons">
<button <button
v-if="!fullscreen" v-if="!fullscreen"
class="ui secondary button" class="ui secondary button"
@ -43,6 +45,7 @@ onScopeDispose(() => {
> >
<i class="icon expand arrows alternate" /> <i class="icon expand arrows alternate" />
</button> </button>
</Teleport>
<Transition name="slide-down"> <Transition name="slide-down">
<div <div
@ -77,27 +80,6 @@ onScopeDispose(() => {
} }
} }
button {
z-index: 2;
position: absolute;
right: 1em;
bottom: 1em;
padding: 0.78571429em;
margin-right: 0 !important;
i.icon {
display: inline-block;
margin-right: 0 !important;
display: contents;
&::before {
display: flex;
justify-content: center;
width: 1em;
height: 1em;
}
}
}
} }
.track-info { .track-info {

View File

@ -307,6 +307,45 @@
canvas { canvas {
z-index: 1; z-index: 1;
} }
&:hover .cover-buttons {
opacity: 1;
transform: translateY(0);
}
.cover-buttons {
position: absolute;
bottom: 1em;
right: 1em;
z-index: 2;
display: flex;
flex-direction: row-reverse;
transition: all 0.2s ease-in-out;
opacity: 0;
transform: translateY(0.5em);
button {
z-index: 2;
padding: 0.78571429em;
&:first-child {
margin-right: 0 !important;
}
i.icon {
display: inline-block;
margin-right: 0 !important;
display: contents;
&::before {
display: flex;
justify-content: center;
width: 1em;
height: 1em;
}
}
}
}
} }
} }