-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayerBarComponent.svelte
More file actions
79 lines (71 loc) · 2.03 KB
/
PlayerBarComponent.svelte
File metadata and controls
79 lines (71 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<script>
// @ts-nocheck
import { get } from "svelte/store";
import { isPlaying, currentSong, playOrPauseSong, playPercentage } from "../scripts/playbackService";
$: $currentSong;
$: $isPlaying;
$: $playPercentage;
function togglePlay() {
if(get(currentSong)){
playOrPauseSong(get(currentSong).id);
}
}
</script>
<div class="container-fluid player-bar mb-2 rounded rounded-5">
<div class="row space-between">
<div class="col-9 rounded-end rounded-end-0 rounded-5 border border-1 border-white" style="background: linear-gradient(to right, gray {$playPercentage}%, #5bbd99 {$playPercentage}%);">
<button type="button" class="btn clickable-text rounded-end rounded-end-0 rounded-5" data-bs-toggle="{$currentSong ? "modal" : ""}" data-bs-target="{$currentSong ? "#songControlModal" : ""}">
{#if $currentSong}
{$currentSong.name}
{:else}
No song playing
{/if}
</button>
</div>
<div class="col-3 border-start border-2">
<button on:click={togglePlay} class="btn btn-dark border border-1 border-white play-button rounded-end rounded-end-5 w-100">
{#if $currentSong && $isPlaying}
<i class="fa-solid fa-pause"></i>
{:else}
<i class="fa-solid fa-play"></i>
{/if}
</button>
</div>
</div>
</div>
<style>
.player-bar .clickable-text {
font-size: 0.85rem;
max-height: 2.8rem;
min-height: 2.8rem;
width: 100%;
font-weight: bold;
color: white;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 2px;
}
.player-bar {
background-color: gray !important;
}
.play-button {
font-weight: bolder;
font-size: 1.4rem;
width: 100%;
height: 100%;
display: block !important;
margin: 0;
color: #5bbd99;
font-weight: bolder;
}
.player-bar .col-9 {
padding: 0 !important;
}
.player-bar .col-3 {
padding: 0 !important;
}
</style>