koel/resources/assets/js/components/shared/artist-item.vue

54 lines
1.4 KiB
Vue
Raw Normal View History

2015-12-13 04:42:28 +00:00
<template>
<article class="item" v-if="artist.songCount">
2015-12-22 09:53:03 +00:00
<span class="cover" :style="{ backgroundImage: 'url('+artist.image+')' }">
2015-12-13 04:42:28 +00:00
<a class="control" @click.prevent="play">
<i class="fa fa-play"></i>
</a>
</span>
<footer>
2016-01-15 07:27:25 +00:00
<a class="name" @click.prevent="viewDetails">{{ artist.name }}</a>
2015-12-13 04:42:28 +00:00
<p class="meta">
2016-01-15 07:27:25 +00:00
{{ artist.albums.length }} album{{ artist.albums.length == 1 ? '' : 's' }}
2015-12-13 04:42:28 +00:00
{{ artist.songCount }} song{{ artist.songCount == 1 ? '' : 's' }}
</p>
</footer>
</article>
</template>
<script>
import playback from '../../services/playback';
import artistStore from '../../stores/artist';
export default {
props: ['artist'],
methods: {
/**
* Play all songs by the current artist.
*/
play() {
playback.playAllByArtist(this.artist);
2015-12-13 04:42:28 +00:00
},
2016-01-15 07:27:25 +00:00
viewDetails() {
this.$root.loadArtist(this.artist);
},
2015-12-13 04:42:28 +00:00
},
};
</script>
<style lang="sass">
@import "resources/assets/sass/partials/_vars.scss";
@import "resources/assets/sass/partials/_mixins.scss";
2016-01-15 07:27:25 +00:00
a.name {
display: block;
color: $colorMainText;
&:hover {
color: $colorHighlight;
}
}
2015-12-13 04:42:28 +00:00
</style>