PlaylistItem.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <div class="playlist">
  3. <div class="left-part">
  4. <p class="top-text">{{ playlist.displayName }}</p>
  5. <p class="bottom-text">
  6. {{ totalLength(playlist) }} •
  7. {{ playlist.songs.length }}
  8. {{ playlist.songs.length === 1 ? "song" : "songs" }}
  9. </p>
  10. </div>
  11. <div class="actions">
  12. <slot name="actions" />
  13. </div>
  14. </div>
  15. </template>
  16. <script>
  17. import utils from "../js/utils";
  18. export default {
  19. props: {
  20. playlist: Object
  21. },
  22. data() {
  23. return {
  24. utils
  25. };
  26. },
  27. methods: {
  28. totalLength(playlist) {
  29. let length = 0;
  30. playlist.songs.forEach(song => {
  31. length += song.duration;
  32. });
  33. return this.utils.formatTimeLong(length);
  34. }
  35. }
  36. };
  37. </script>
  38. <style lang="scss" scoped>
  39. @import "styles/global.scss";
  40. .playlist {
  41. width: 100%;
  42. height: 72px;
  43. border: 0.5px $light-grey-2 solid;
  44. margin-bottom: 12px;
  45. border-radius: 0 5px 5px 0;
  46. display: flex;
  47. .top-text {
  48. color: $dark-grey-2;
  49. font-size: 20px;
  50. line-height: 23px;
  51. margin-bottom: 0;
  52. }
  53. .bottom-text {
  54. color: $dark-grey-2;
  55. font-size: 16px;
  56. line-height: 19px;
  57. margin-bottom: 0;
  58. margin-top: 6px;
  59. &:first-letter {
  60. text-transform: uppercase;
  61. }
  62. }
  63. .left-part {
  64. flex: 1;
  65. padding: 12px;
  66. }
  67. .actions {
  68. display: flex;
  69. align-items: center;
  70. padding: 12px;
  71. }
  72. button,
  73. .button {
  74. width: 100%;
  75. font-size: 17px;
  76. height: 36px;
  77. }
  78. }
  79. </style>