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>
<template>
@ -165,12 +172,19 @@ const hideArtist = () => {
<template v-if="currentTrack">
<div class="cover-container">
<div class="cover">
<milk-drop />
<img
v-if="coverType === CoverType.COVER_ART"
ref="cover"
alt=""
: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>
<h1 class="ui header">

View File

@ -36,13 +36,16 @@ onScopeDispose(() => {
ref="canvas"
@click="loadRandomPreset()"
/>
<button
v-if="!fullscreen"
class="ui secondary button"
@click="enter"
>
<i class="icon expand arrows alternate" />
</button>
<Teleport to=".cover > .cover-buttons">
<button
v-if="!fullscreen"
class="ui secondary button"
@click="enter"
>
<i class="icon expand arrows alternate" />
</button>
</Teleport>
<Transition name="slide-down">
<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 {

View File

@ -307,6 +307,45 @@
canvas {
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;
}
}
}
}
}
}