move progress bar and hot keys to new components

This commit is contained in:
geoffrey45
2022-01-28 22:42:13 +03:00
parent 17c9f3a23e
commit e847574446
9 changed files with 243 additions and 174 deletions
+9 -3
View File
@@ -1,5 +1,11 @@
<template>
<div class="result-item border">
<router-link
:to="{
name: 'AlbumView',
params: { album: album.name, artist: album.artist },
}"
class="result-item border"
>
<div
class="album-art image"
:style="{
@@ -8,7 +14,7 @@
></div>
<div class="title ellip">{{ album.name }}</div>
<div class="artistsx ellipsis">{{ album.artist }}</div>
</div>
</router-link>
</template>
<script>
@@ -48,4 +54,4 @@ export default {
color: rgba(40, 116, 216, 0.767);
}
}
</style>
</style>
+58
View File
@@ -0,0 +1,58 @@
<template>
<div class="nav">
<div class="image" id="previous" @click="playPrev"></div>
<div
class="image play-pause"
@click="playPause"
:class="{ isPlaying: isPlaying }"
></div>
<div class="image" id="next" @click="playNext"></div>
</div>
</template>
<script setup>
import playAudio from "../../composables/playAudio";
const playPause = playAudio.playPause;
const playNext = playAudio.playNext;
const playPrev = playAudio.playPrev;
const isPlaying = playAudio.playing;
</script>
<style lang="scss">
.nav {
display: grid;
grid-template-columns: repeat(3, 1fr);
width: 100%;
gap: $small;
& * {
height: 2rem;
width: 2rem;
background-size: 1.2rem !important;
cursor: pointer;
border-radius: 0.5rem;
&:hover {
background-color: $pink;
}
}
#previous {
background-image: url(../../assets/icons/previous.svg);
}
.play-pause {
background-image: url(../../assets/icons/play.svg);
}
.isPlaying {
background-image: url(../../assets/icons/pause.svg);
}
#next {
background-image: url(../../assets/icons/next.svg);
}
}
</style>
+20
View File
@@ -0,0 +1,20 @@
<template>
<input
id="progress"
type="range"
:value="pos"
min="0"
max="1000"
@change="seek()"
/>
</template>
<script setup>
import { ref } from "vue";
import playAudio from "../../composables/playAudio";
const pos = ref(playAudio.pos);
const seek = () => {
playAudio.seek(document.getElementById("progress").value);
};
</script>