PlaylistItem.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 {
  50. background-color: $dark-grey-2 !important;
  51. border: 0 !important;
  52. p {
  53. color: $night-mode-text !important;
  54. }
  55. }
  56. }
  57. .playlist {
  58. width: 100%;
  59. height: 72px;
  60. border: 0.5px $light-grey-2 solid;
  61. border-radius: 3px;
  62. display: flex;
  63. .top-text {
  64. color: $dark-grey-2;
  65. font-size: 20px;
  66. line-height: 23px;
  67. margin-bottom: 0;
  68. .privateIcon {
  69. color: $dark-pink;
  70. font-size: 18px;
  71. }
  72. }
  73. .bottom-text {
  74. color: $dark-grey-2;
  75. font-size: 16px;
  76. line-height: 19px;
  77. margin-bottom: 0;
  78. margin-top: 6px;
  79. &:first-letter {
  80. text-transform: uppercase;
  81. }
  82. }
  83. .left-part {
  84. flex: 1;
  85. padding: 12px;
  86. }
  87. .actions {
  88. display: flex;
  89. align-items: center;
  90. padding: 12px;
  91. div {
  92. display: flex;
  93. align-items: center;
  94. button,
  95. .button {
  96. width: 100%;
  97. font-size: 17px;
  98. height: 36px;
  99. &:not(:last-of-type) {
  100. margin-right: 5px;
  101. }
  102. }
  103. }
  104. }
  105. }
  106. </style>