123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <template>
- <div class="playlist-item universal-item">
- <div class="left-part">
- <p class="item-title">
- {{ playlist.displayName }}
- <i
- v-if="playlist.privacy === 'private'"
- class="private-playlist-icon material-icons"
- content="This playlist is not visible to other users."
- v-tippy
- >lock</i
- >
- </p>
- <p class="item-description">
- {{ totalLength(playlist) }} •
- {{ playlist.songs.length }}
- {{ playlist.songs.length === 1 ? "song" : "songs" }}
- </p>
- </div>
- <div class="universal-item-actions">
- <slot name="actions" />
- </div>
- </div>
- </template>
- <script>
- import utils from "../../js/utils";
- export default {
- props: {
- playlist: { type: Object, default: () => {} }
- },
- data() {
- return {
- utils
- };
- },
- methods: {
- totalLength(playlist) {
- let length = 0;
- playlist.songs.forEach(song => {
- length += song.duration;
- });
- return this.utils.formatTimeLong(length);
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .night-mode {
- .playlist-item {
- background-color: var(--dark-grey-2) !important;
- border: 0 !important;
- p {
- color: var(--light-grey-2) !important;
- }
- }
- }
- .playlist-item {
- width: 100%;
- height: 72px;
- .item-title {
- color: var(--dark-grey-2);
- font-size: 20px;
- line-height: 23px;
- margin-bottom: 0;
- display: flex;
- align-items: center;
- .private-playlist-icon {
- color: var(--dark-pink);
- font-size: 18px;
- margin-left: 5px;
- }
- }
- .left-part {
- flex: 1;
- padding: 12px;
- }
- .universal-item-actions {
- div {
- display: flex;
- align-items: center;
- button,
- .button {
- width: 100%;
- font-size: 17px;
- height: 36px;
- &:not(:last-of-type) {
- margin-right: 5px;
- }
- }
- }
- }
- }
- </style>
|