2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
|
|
|
<section class="track-listing">
|
|
|
|
<h1>Track Listing</h1>
|
|
|
|
|
|
|
|
<ul class="tracks">
|
2022-07-08 14:53:04 +00:00
|
|
|
<li v-for="(track, index) in tracks" :key="index" data-testid="album-track-item">
|
|
|
|
<TrackListItem :album="album" :track="track"/>
|
|
|
|
</li>
|
2022-04-15 14:24:30 +00:00
|
|
|
</ul>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
<script lang="ts" setup>
|
2022-07-08 14:53:04 +00:00
|
|
|
import { onMounted, provide, ref, toRefs } from 'vue'
|
2022-06-10 10:47:46 +00:00
|
|
|
import { songStore } from '@/stores'
|
|
|
|
import { SongsKey } from '@/symbols'
|
2022-07-08 14:53:04 +00:00
|
|
|
import TrackListItem from '@/components/album/AlbumTrackListItem.vue'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
const props = defineProps<{ album: Album, tracks: AlbumTrack[] }>()
|
|
|
|
const { album, tracks } = toRefs(props)
|
2022-06-10 10:47:46 +00:00
|
|
|
|
|
|
|
const songs = ref<Song[]>([])
|
|
|
|
|
|
|
|
provide(SongsKey, songs)
|
|
|
|
|
|
|
|
onMounted(async () => songs.value = await songStore.fetchForAlbum(album.value))
|
2022-04-15 14:24:30 +00:00
|
|
|
</script>
|
2022-04-21 10:43:10 +00:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2022-07-08 14:53:04 +00:00
|
|
|
section {
|
|
|
|
h1 {
|
|
|
|
font-size: 1.4rem;
|
|
|
|
margin-bottom: 0;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
ul {
|
|
|
|
counter-reset: trackCounter;
|
|
|
|
}
|
|
|
|
|
|
|
|
li {
|
|
|
|
counter-increment: trackCounter;
|
|
|
|
display: flex;
|
|
|
|
padding: 8px;
|
2022-04-21 10:43:10 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
&::before {
|
|
|
|
content: counter(trackCounter);
|
|
|
|
flex: 0 0 24px;
|
|
|
|
opacity: .5;
|
|
|
|
}
|
2022-04-21 10:43:10 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
&:nth-child(even) {
|
|
|
|
background: rgba(255, 255, 255, 0.05);
|
|
|
|
}
|
2022-04-21 10:43:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|