PlaylistItem.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="playlist-item universal-item">
  3. <div class="left-part">
  4. <p class="item-title">
  5. {{ playlist.displayName }}
  6. <i
  7. v-if="playlist.privacy === 'private'"
  8. class="private-playlist-icon material-icons"
  9. content="This playlist is not visible to other users."
  10. v-tippy
  11. >lock</i
  12. >
  13. </p>
  14. <p class="item-description">
  15. {{ totalLength(playlist) }} •
  16. {{ playlist.songs.length }}
  17. {{ playlist.songs.length === 1 ? "song" : "songs" }}
  18. </p>
  19. </div>
  20. <div class="universal-item-actions">
  21. <slot name="actions" />
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import utils from "../../js/utils";
  27. export default {
  28. props: {
  29. playlist: { type: Object, default: () => {} }
  30. },
  31. data() {
  32. return {
  33. utils
  34. };
  35. },
  36. methods: {
  37. totalLength(playlist) {
  38. let length = 0;
  39. playlist.songs.forEach(song => {
  40. length += song.duration;
  41. });
  42. return this.utils.formatTimeLong(length);
  43. }
  44. }
  45. };
  46. </script>
  47. <style lang="scss" scoped>
  48. .night-mode {
  49. .playlist-item {
  50. background-color: var(--dark-grey-2) !important;
  51. border: 0 !important;
  52. p {
  53. color: var(--light-grey-2) !important;
  54. }
  55. }
  56. }
  57. .playlist-item {
  58. width: 100%;
  59. height: 72px;
  60. .item-title {
  61. color: var(--dark-grey-2);
  62. font-size: 20px;
  63. line-height: 23px;
  64. margin-bottom: 0;
  65. display: flex;
  66. align-items: center;
  67. .private-playlist-icon {
  68. color: var(--dark-pink);
  69. font-size: 18px;
  70. margin-left: 5px;
  71. }
  72. }
  73. .left-part {
  74. flex: 1;
  75. padding: 12px;
  76. }
  77. .universal-item-actions {
  78. div {
  79. display: flex;
  80. align-items: center;
  81. button,
  82. .button {
  83. width: 100%;
  84. font-size: 17px;
  85. height: 36px;
  86. &:not(:last-of-type) {
  87. margin-right: 5px;
  88. }
  89. }
  90. }
  91. }
  92. }
  93. </style>