PlaylistItem.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. title="This playlist is not visible to other users."
  10. >lock</i
  11. >
  12. </p>
  13. <p class="item-description">
  14. {{ totalLength(playlist) }} •
  15. {{ playlist.songs.length }}
  16. {{ playlist.songs.length === 1 ? "song" : "songs" }}
  17. </p>
  18. </div>
  19. <div class="universal-item-actions">
  20. <slot name="actions" />
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. import utils from "../../../js/utils";
  26. export default {
  27. props: {
  28. playlist: { type: Object, default: () => {} }
  29. },
  30. data() {
  31. return {
  32. utils
  33. };
  34. },
  35. methods: {
  36. totalLength(playlist) {
  37. let length = 0;
  38. playlist.songs.forEach(song => {
  39. length += song.duration;
  40. });
  41. return this.utils.formatTimeLong(length);
  42. }
  43. }
  44. };
  45. </script>
  46. <style lang="scss" scoped>
  47. @import "../../styles/global.scss";
  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>