|
1 | 1 | <script> |
2 | | -// @ts-nocheck |
| 2 | + // @ts-nocheck |
3 | 3 | import { getImageUrl } from "../scripts/api"; |
4 | 4 | import { navigateTo } from "../scripts/routeService.js"; |
| 5 | + import { playOrPauseSong, setPlaylists } from "../scripts/playbackService"; |
5 | 6 | // @ts-nocheck |
6 | 7 | export let playlist = null; |
7 | 8 |
|
8 | | - async function viewPlaylist() { |
9 | | - navigateTo(`/Playlist`, { playlistId : playlist.id }); |
| 9 | + function viewPlaylist() { |
| 10 | + navigateTo(`/Playlist`, { playlistId: playlist.id }); |
| 11 | + } |
| 12 | +
|
| 13 | + function playPlaylist() { |
| 14 | + setPlaylists(playlist.id); |
| 15 | + playOrPauseSong(null); |
10 | 16 | } |
11 | 17 | </script> |
12 | 18 |
|
13 | 19 | <div class="playlist-component"> |
14 | 20 | {#if playlist} |
15 | | - <button on:click={viewPlaylist} class="playlist-item btn w-100 border border-3" style="--url: url({getImageUrl(playlist.thumbnailPath)}); {true ? "border-color: #5bbd99 !important;" : ""}"> |
16 | | - <h3>{playlist.name}</h3> |
17 | | - <p>{playlist.description}</p> |
18 | | - </button> |
| 21 | + <div class="row me-1"> |
| 22 | + <button aria-label="play button" on:click={playPlaylist} class="col-2 play-btn"> |
| 23 | + <i class="fa-solid fa-play"></i> |
| 24 | + </button> |
| 25 | + <button aria-label="playlist button" on:click={viewPlaylist} class="playlist-item btn border border-3 col-10" style="--url: url({getImageUrl(playlist.thumbnailPath)});"> </button> |
| 26 | + <div class="text-start col-12 cursor"> |
| 27 | + <p>#{playlist.name}<br />{playlist.description}</p> |
| 28 | + </div> |
| 29 | + </div> |
19 | 30 | {:else} |
20 | 31 | <p>No playlist available.</p> |
21 | 32 | {/if} |
22 | 33 | </div> |
23 | 34 |
|
24 | 35 | <style> |
| 36 | + p { |
| 37 | + font-size: 0.7rem !important; |
| 38 | + } |
| 39 | +
|
25 | 40 | .playlist-item { |
26 | 41 | background-image: var(--url); |
27 | 42 | background-size: cover; |
28 | 43 | background-position: center; |
| 44 | + border-color: transparent !important; |
29 | 45 | font-weight: bolder; |
30 | 46 | color: white; |
31 | | - height: 10rem; |
| 47 | + min-height: 5rem; |
| 48 | + transform: scale(1); |
| 49 | + transition: transform 0.5s; |
| 50 | + } |
| 51 | +
|
| 52 | + .playlist-item:hover { |
| 53 | + transform: scale(1.05); |
| 54 | + transition: transform 0.5s; |
| 55 | + } |
| 56 | +
|
| 57 | + .play-btn { |
| 58 | + font-size: 1.8rem; |
| 59 | + background-color: rgba(131, 131, 131, 0.068) !important; |
| 60 | + border: none !important; |
| 61 | + color: #1cc558 !important; |
| 62 | + border-top-left-radius: 10px; |
| 63 | + border-bottom-left-radius: 10px; |
| 64 | + border-left: #1cc558 3px solid !important; |
| 65 | + transform: scale(1); |
| 66 | + transition: transform 0.5s; |
| 67 | + } |
| 68 | +
|
| 69 | + .play-btn:hover { |
| 70 | + transform: scale(1.05); |
| 71 | + transition: transform 0.5s; |
32 | 72 | } |
33 | 73 |
|
34 | 74 | .playlist-component { |
35 | 75 | margin-top: 10px; |
36 | 76 | } |
| 77 | +
|
| 78 | + .row{ |
| 79 | + border: #1cc55711 2px solid; |
| 80 | + border-radius: 10px; |
| 81 | + } |
| 82 | +
|
| 83 | + .row:hover{ |
| 84 | + transition: background-color 0.4s; |
| 85 | + background-color: rgba(128, 128, 128, 0.096); |
| 86 | + border-radius: 15px; |
| 87 | + border-bottom: #1cc557 3px solid; |
| 88 | + } |
37 | 89 | </style> |
0 commit comments