PlaylistItem.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <div class="playlist">
  3. <div class="left-part">
  4. <p class="top-text">
  5. {{ playlist.displayName }}
  6. <i
  7. v-if="playlist.privacy === 'private'"
  8. class="privateIcon material-icons"
  9. title="This playlist is not visible to other users."
  10. >lock</i
  11. >
  12. </p>
  13. <p class="bottom-text">
  14. {{ totalLength(playlist) }} •
  15. {{ playlist.songs.length }}
  16. {{ playlist.songs.length === 1 ? "song" : "songs" }}
  17. </p>
  18. </div>
  19. <div class="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 p {
  50. color: $night-mode-text !important;
  51. }
  52. }
  53. .playlist {
  54. width: 100%;
  55. height: 72px;
  56. border: 0.5px $light-grey-2 solid;
  57. border-radius: 3px;
  58. display: flex;
  59. .top-text {
  60. color: $dark-grey-2;
  61. font-size: 20px;
  62. line-height: 23px;
  63. margin-bottom: 0;
  64. .privateIcon {
  65. color: $dark-pink;
  66. font-size: 18px;
  67. }
  68. }
  69. .bottom-text {
  70. color: $dark-grey-2;
  71. font-size: 16px;
  72. line-height: 19px;
  73. margin-bottom: 0;
  74. margin-top: 6px;
  75. &:first-letter {
  76. text-transform: uppercase;
  77. }
  78. }
  79. .left-part {
  80. flex: 1;
  81. padding: 12px;
  82. }
  83. .actions {
  84. display: flex;
  85. align-items: center;
  86. padding: 12px;
  87. }
  88. button,
  89. .button {
  90. width: 100%;
  91. font-size: 17px;
  92. height: 36px;
  93. }
  94. }
  95. </style>