-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.html
365 lines (299 loc) · 15.6 KB
/
player.html
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Spotify Cencept Rework</title>
<!-- MDI Icons -->
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/6.5.95/css/materialdesignicons.min.css" />
<!-- Tailwind -->
<script src="https://cdn-tailwindcss.vercel.app/"></script>
<!-- AlpineJS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/alpinejs/3.8.1/cdn.min.js" defer></script>
<!-- Quicksand -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500&display=swap" rel="stylesheet">
<style>
html, body {
font-family: 'Quicksand', sans-serif;
}
/* alpinejs */
[x-cloak] {
display: none !important;
}
/* custom rounded classes */
.rounded-xxl {
border-radius: 30px;
}
.rounded-t-xxl {
border-top-left-radius: 30px;
border-top-right-radius: 30px;
}
.rounded-b-xxl {
border-bottom-left-radius: 30px;
border-bottom-right-radius: 30px;
}
/* Range Input */
.x-slider * {
width: 350px !important;
}
.x-slider input::-webkit-slider-thumb {
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #636363;
border: 5px solid #24c55d;
box-shadow: 0px 0px 40px -4px rgba(0, 0, 0, 0.76);
transition: all 0.1s ease-in-out;
outline: none;
appearance: none;
}
.x-slider input::-webkit-slider-thumb:hover {
border-color: #1bb350;
}
/* Player Controls */
.x-player-controls .play-pause{
transform: scale(3);
}
.x-player-controls .play-pause:hover{
transform: scale(3.1);
}
.x-player-controls .center-controls{
transform: scale(2.5);
}
.x-player-controls .center-controls:hover{
transform: scale(2.7);
}
.x-player-controls .side-controls{
transform: scale(1.8);
}
.x-player-controls .side-controls:hover{
transform: scale(2);
}
</style>
</head>
<body>
<!-- Page Container -->
<div class="flex flex-col items-center justify-center bg-white" x-cloak x-data="appData()" x-init="appInit()">
<!-- Player -->
<div class="relative min-h-screen bg-white
rounded-xxl bg-amber-500 w-96 mx-auto my-20">
<!-- Player Cover -->
<img class="absolute rounded-xxl object-cover h-full w-full"
src="https://images.unsplash.com/photo-1619983081563-430f63602796?fit=crop&w=450&h=800&q=80"
alt="Product Preview" />
<div class="flex flex-col absolute h-full w-full">
<!-- Top -->
<div class="flex-none group h-20 w-fit-screen rounded-t-xxl mb-auto">
<!-- Shadow Bar -->
<div class="flex flex-row flex-grow justify-start rounded-t-xxl
h-16 w-fit-screen px-3 space-x-2
bg-gradient-to-b from-black/70 via-gray-800/70 to-transparent
opacity-80 group-hover:opacity-100
transition-all ease-in-out duration-200 delay-100">
<!-- Slide Down Button -->
<button class="flex-none px-1 h-10 w-10 my-auto hover:scale-125
transition-all duration-200 ease-in-out" title="Slide Down">
<i class="mdi mdi-chevron-down text-2xl text-gray-200
hover:text-white transition-all duration-200"></i>
</button>
<!-- Grow Space -->
<div class="grow"></div>
<!-- Share Button -->
<button class="flex-none h-10 w-10 my-auto hover:scale-125
transition-all duration-200 ease-in-out" title="Share With">
<i class="mdi mdi-share-variant-outline text-xl text-gray-200
hover:text-white transition-all duration-200"></i>
</button>
<!-- Options Button -->
<button class="flex-none h-10 w-10 my-auto hover:scale-125
transition-all duration-200 ease-in-out" title="Show Options">
<i class="mdi mdi-dots-vertical text-2xl text-gray-200
hover:text-white transition-all duration-200"></i>
</button>
</div>
</div>
<div class="my-auto"></div>
<!-- Player -->
<div class="flex-none group h-2/4 w-fit-screen rounded-b-xxl mt-auto backdrop-blur-md">
<!-- Shadow Bar -->
<div class="flex flex-col justify-start rounded-b-xxl
h-full w-fit-screen px-3 space-x-2 my-auto
bg-black/70 via-gray-800/70 to-transparent
opacity-95 group-hover:opacity-100
transition-all ease-in-out duration-200 delay-100">
<!-- Song Details -->
<div class="flex flex-row flex-grow justify-start mt-3 pl-2">
<div class="flex flex-col">
<div class="text-gray-400/90 text-xl font-semibold select-none">
Kalbimi Kırdın
</div>
<div class="text-gray-500/90 text-base font-semibold select-none">
Zeynep Yastık & Yorgan
</div>
</div>
<!-- Grow Space -->
<div class="grow"></div>
<div class="flex flex-row">
<!-- Make Karaoke -->
<button class="flex-none px-1 h-10 w-10 my-auto hover:scale-125 rotate-45
transition-all duration-200 ease-in-out" title="Karaoke">
<i class="mdi mdi-microphone-variant text-2xl text-gray-200
hover:text-white transition-all duration-200"></i>
</button>
<!-- Like This Song -->
<button class="flex-none px-1 h-10 w-10 my-auto hover:scale-125
transition-all duration-200 ease-in-out" title="Like This Song">
<i class="mdi mdi-heart text-2xl text-green-500 shadow-lg
hover:text-white transition-all duration-200"></i>
</button>
</div>
</div>
<!-- Player Slider Container -->
<div class="x-slider flex relative my-3">
<!-- Player Slider -->
<div class="x-slider inline justify-center rounded-md">
<!-- Range Input -->
<input class="absolute bg-transparent rounded-md
z-10 h-1 w-80 outline-0 appearance-none" type="range"
step="1" min='0' max="100" value="0"
x-model="sliderValue"
x-on:change.debounce="sliderProgressTime = sliderProgressToTime(sliderValue, songLength)">
<!-- Slider Placeholder -->
<div class="absolute z-0 w-80 h-0.5 mt-0.5 rounded-md bg-gray-500/70"></div>
<!-- Progress -->
<div class="absolute z-0 w-80 h-1.5 rounded-md bg-green-600
bg-gradient-to-r from-emerald-700 to-green-500"
x-bind:style="'width: ' + (sliderValue * 3.5) + 'px !important; '"></div>
<!-- x-slider is width 350px -->
</div>
</div>
<!-- Duration Container -->
<div class="flex flex-row flex-grow justify-start px-0.5">
<!-- Current Time -->
<div class="text-gray-500/90 text-sm select-none" x-text="sliderProgressTime"></div>
<!-- Grow Space -->
<div class="grow"></div>
<!-- Total Time -->
<div class="text-gray-400/90 text-sm select-none pr-1" x-text="secondsToDuration(songLength)"></div>
</div>
<!-- Player Controls Container -->
<div class="x-player-controls flex flex-row flex-grow justify-start
space-x-8 mx-4 px-3">
<!-- Suffle -->
<button class="side-controls flex-none px-1 h-10 w-10 my-auto
transition-all duration-200 ease-in-out" title="Suffle">
<i class="mdi mdi-gamepad-circle-right text-gray-300/90
hover:text-white transition-all duration-200"></i>
</button>
<!-- Previous - Begining -->
<button class="center-controls flex-none px-1 h-10 w-10 my-auto
transition-all duration-200 ease-in-out" title="Previous">
<i class="mdi mdi-skip-previous-outline text-2xl text-gray-200/95
hover:text-white transition-all duration-200"></i>
</button>
<!-- Play - Pause -->
<button class="play-pause flex-none px-1 h-10 w-10 my-auto
transition-all duration-200 ease-in-out" title="Play/Pause">
<i class="mdi mdi-play-circle-outline text-2xl text-gray-200
hover:text-white transition-all duration-200"></i>
</button>
<!-- Next - End -->
<button class="center-controls flex-none px-1 h-10 w-10 my-auto
transition-all duration-200 ease-in-out" title="Next Song">
<i class="mdi mdi-skip-next-outline text-2xl text-gray-200/95
hover:text-white transition-all duration-200"></i>
</button>
<!-- Repeat -->
<button class="side-controls flex-none px-1 h-10 w-10 my-auto
transition-all duration-200 ease-in-out" title="Repeat">
<i class="mdi mdi-repeat text-gray-300/90
hover:text-white transition-all duration-200"></i>
</button>
</div>
<!-- Source Playlist -->
<div class="flex flex-row flex-grow justify-start
border-t border-gray-600/50 mt-5 pt-1">
<!-- Album -->
<button class="side-controls flex-none
h-10 w-10 my-auto hover:scale-125
transition-all duration-200">
<!-- Cover -->
<img class="h-8 w-8 rounded-full border border-gray-600"
src="https://images.unsplash.com/photo-1612982663544-54e9d6d2818d?fit=crop&w=50&h=50&q=80" alt="Album">
</button>
<!-- Playlist -->
<div class="flex flex-col my-auto mx-2 ">
<!-- Title -->
<div class="text-gray-500/90 text-xs font-semibold select-none cursor-pointer">
From Playlist
</div>
<!-- Playlist Name -->
<div class="text-gray-300/90 text-base font-semibold select-none cursor-pointer">
Daily Discover
</div>
</div>
<!-- Grow Space -->
<div class="grow"></div>
<!-- Slide Down Button -->
<button class="flex-none px-1 h-10 w-10 my-auto hover:scale-125
transition-all duration-200 ease-in-out" title="Show Playlist">
<i class="mdi mdi-chevron-up text-2xl text-gray-200
hover:text-white transition-all duration-200"></i>
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Notes -->
<span class="text-center font-bold my-20">
MDI (npm i @mdi/font) reuqired for icons
<hr class="my-4">
<a href="https://egoistdeveloper.github.io/twcss-to-sass-playground/" target="_blank" class="text-blue-600">
Convetert to SASS
</a>
<hr class="my-4">
<a href="https://tailwindcomponents.com/component/progress-slider-component" target="_blank" class="text-blue-600">
Standalone Slider Component
</a>
<hr class="my-4">
<a href="https://unsplash.com/photos/QzpgqElvSiA" target="_blank" class="text-blue-600">
Cover Image
</a>
<hr class="my-4">
<a href="https://unsplash.com/photos/af0KTGlI4ss" target="_blank" class="text-blue-600">
Playlist Image
</a>
</span>
</div>
<script>
function appData() {
return {
sliderValue: 50,
songLength: 250,
sliderProgressTime: '00:00',
appInit() {
this.sliderProgressTime = this.sliderProgressToTime(this.sliderValue, this.songLength);
},
/*
* Convert slider value to time
*/
secondsToDuration(seconds) {
var minutes = Math.floor(seconds / 60).toFixed(0),
seconds = Math.floor(seconds % 60).toFixed(0);
return minutes + ":" + (seconds < 10 ? "0" : "") + seconds;
},
/*
* Slider progress value to time
*/
sliderProgressToTime(sliderValue, songLength) {
return this.secondsToDuration((songLength / 100) * sliderValue);
}
}
}
</script>
</body>
</html>