srcdev-nuxt-components 2.1.22 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="slider-gallery" ref="sliderGalleryWrapper">
|
|
3
|
+
<div class="list" ref="sliderGalleryImagesList">
|
|
4
|
+
<div v-for="item in galleryData" class="item">
|
|
5
|
+
<img :src="item.src" />
|
|
6
|
+
<div class="content">
|
|
7
|
+
<div class="author">{{ item.stylist }}</div>
|
|
8
|
+
<div class="title">{{ item.title }}</div>
|
|
9
|
+
<div class="topic">{{ item.category }}</div>
|
|
10
|
+
<div class="des">{{ item.description }}</div>
|
|
11
|
+
<div class="buttons">
|
|
12
|
+
<button>SEE MORE</button>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="thumbnail" ref="sliderGalleryThumbnailsList">
|
|
19
|
+
<div v-for="item in galleryData" class="item">
|
|
20
|
+
<img :src="item.src" />
|
|
21
|
+
<div class="content">
|
|
22
|
+
<div class="title">Name Slider</div>
|
|
23
|
+
<div class="description">Description</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div class="arrows">
|
|
29
|
+
<button id="prev" ref="prevDom" @click.prevent="doPrevious()"><</button>
|
|
30
|
+
<button id="next" ref="nextDom" @click.prevent="doNext()">></button>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div class="time" ref="timeDom"></div>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
const props = defineProps({
|
|
39
|
+
styleClassPassthrough: {
|
|
40
|
+
type: Array as PropType<string[]>,
|
|
41
|
+
default: () => [],
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
interface IGalleryData {
|
|
46
|
+
src: string;
|
|
47
|
+
alt: string;
|
|
48
|
+
stylist?: string;
|
|
49
|
+
title?: string;
|
|
50
|
+
category?: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { elementClasses, resetElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
55
|
+
const galleryData = defineModel<IGalleryData[]>('galleryData');
|
|
56
|
+
|
|
57
|
+
const sliderGalleryWrapper = useTemplateRef('sliderGalleryWrapper');
|
|
58
|
+
const sliderGalleryImagesList = useTemplateRef('sliderGalleryImagesList');
|
|
59
|
+
const sliderGalleryThumbnailsList = useTemplateRef('sliderGalleryThumbnailsList');
|
|
60
|
+
const timeDom = useTemplateRef('timeDom');
|
|
61
|
+
|
|
62
|
+
const timeRunning = 3000;
|
|
63
|
+
const timeAutoNext = 7000;
|
|
64
|
+
|
|
65
|
+
const doNext = () => {
|
|
66
|
+
showSlider('next');
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const doPrevious = () => {
|
|
70
|
+
showSlider('prev');
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
let runTimeOut: any;
|
|
74
|
+
let runNextAuto = setTimeout(() => {
|
|
75
|
+
doNext();
|
|
76
|
+
}, timeAutoNext);
|
|
77
|
+
|
|
78
|
+
function showSlider(type: string) {
|
|
79
|
+
// Get fresh references to all items by querying the DOM directly
|
|
80
|
+
const currentSliderItems = Array.from(sliderGalleryImagesList.value?.children || []);
|
|
81
|
+
const currentThumbnailItems = Array.from(sliderGalleryThumbnailsList.value?.children || []);
|
|
82
|
+
|
|
83
|
+
if (type === 'next') {
|
|
84
|
+
// Move the first item to the end
|
|
85
|
+
if (currentSliderItems.length) {
|
|
86
|
+
const firstItem = currentSliderItems[0];
|
|
87
|
+
sliderGalleryImagesList.value?.appendChild(firstItem);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (currentThumbnailItems.length) {
|
|
91
|
+
const firstThumb = currentThumbnailItems[0];
|
|
92
|
+
sliderGalleryThumbnailsList.value?.appendChild(firstThumb);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
sliderGalleryWrapper.value?.classList.add('next');
|
|
96
|
+
} else {
|
|
97
|
+
// Move the last item to the beginning
|
|
98
|
+
if (currentSliderItems.length) {
|
|
99
|
+
const lastItem = currentSliderItems[currentSliderItems.length - 1];
|
|
100
|
+
sliderGalleryImagesList.value?.prepend(lastItem);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (currentThumbnailItems.length) {
|
|
104
|
+
const lastThumb = currentThumbnailItems[currentThumbnailItems.length - 1];
|
|
105
|
+
sliderGalleryThumbnailsList.value?.prepend(lastThumb);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
sliderGalleryWrapper.value?.classList.add('prev');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
clearTimeout(runTimeOut);
|
|
112
|
+
runTimeOut = setTimeout(() => {
|
|
113
|
+
if (sliderGalleryWrapper.value) {
|
|
114
|
+
sliderGalleryWrapper.value.classList.remove('next');
|
|
115
|
+
sliderGalleryWrapper.value.classList.remove('prev');
|
|
116
|
+
}
|
|
117
|
+
}, timeRunning);
|
|
118
|
+
|
|
119
|
+
clearTimeout(runNextAuto);
|
|
120
|
+
runNextAuto = setTimeout(() => {
|
|
121
|
+
doNext();
|
|
122
|
+
}, timeAutoNext);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
watch(
|
|
126
|
+
() => props.styleClassPassthrough,
|
|
127
|
+
() => {
|
|
128
|
+
resetElementClasses(props.styleClassPassthrough);
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
<style lang="css">
|
|
134
|
+
/* slider-gallery */
|
|
135
|
+
.slider-gallery {
|
|
136
|
+
height: 100svh;
|
|
137
|
+
/* margin-top: -50px; */
|
|
138
|
+
width: 100vw;
|
|
139
|
+
overflow: hidden;
|
|
140
|
+
position: absolute;
|
|
141
|
+
inset: 0 0 0 0;
|
|
142
|
+
|
|
143
|
+
.list {
|
|
144
|
+
.item {
|
|
145
|
+
width: 100%;
|
|
146
|
+
height: 100%;
|
|
147
|
+
position: absolute;
|
|
148
|
+
inset: 0 0 0 0;
|
|
149
|
+
|
|
150
|
+
&:nth-child(1) {
|
|
151
|
+
z-index: 1;
|
|
152
|
+
|
|
153
|
+
.content {
|
|
154
|
+
.author,
|
|
155
|
+
.title,
|
|
156
|
+
.topic,
|
|
157
|
+
.des,
|
|
158
|
+
.buttons {
|
|
159
|
+
transform: translateY(50px);
|
|
160
|
+
filter: blur(20px);
|
|
161
|
+
opacity: 0;
|
|
162
|
+
animation: showContent 0.5s 1s linear 1 forwards;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.title {
|
|
166
|
+
animation-delay: 1.2s !important;
|
|
167
|
+
}
|
|
168
|
+
.topic {
|
|
169
|
+
animation-delay: 1.4s !important;
|
|
170
|
+
}
|
|
171
|
+
.des {
|
|
172
|
+
animation-delay: 1.6s !important;
|
|
173
|
+
}
|
|
174
|
+
.buttons {
|
|
175
|
+
animation-delay: 1.8s !important;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
img {
|
|
181
|
+
width: 100%;
|
|
182
|
+
height: 100%;
|
|
183
|
+
object-fit: cover;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.content {
|
|
187
|
+
position: absolute;
|
|
188
|
+
top: 20%;
|
|
189
|
+
width: 1140px;
|
|
190
|
+
max-width: 80%;
|
|
191
|
+
left: 50%;
|
|
192
|
+
transform: translateX(-50%);
|
|
193
|
+
padding-right: 30%;
|
|
194
|
+
box-sizing: border-box;
|
|
195
|
+
color: #fff;
|
|
196
|
+
text-shadow: 0 5px 10px #0004;
|
|
197
|
+
|
|
198
|
+
.author {
|
|
199
|
+
font-weight: bold;
|
|
200
|
+
letter-spacing: 10px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.title {
|
|
204
|
+
font-size: 5em;
|
|
205
|
+
font-weight: bold;
|
|
206
|
+
line-height: 1.3em;
|
|
207
|
+
}
|
|
208
|
+
.topic {
|
|
209
|
+
font-size: 5em;
|
|
210
|
+
font-weight: bold;
|
|
211
|
+
line-height: 1.3em;
|
|
212
|
+
color: #f1683a;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.buttons {
|
|
216
|
+
display: grid;
|
|
217
|
+
grid-template-columns: repeat(2, 130px);
|
|
218
|
+
grid-template-rows: 40px;
|
|
219
|
+
gap: 5px;
|
|
220
|
+
margin-top: 20px;
|
|
221
|
+
|
|
222
|
+
button {
|
|
223
|
+
background-color: #99999975;
|
|
224
|
+
border: 1px solid #fff;
|
|
225
|
+
color: #fff;
|
|
226
|
+
letter-spacing: 3px;
|
|
227
|
+
font-weight: 500;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.thumbnail {
|
|
235
|
+
position: absolute;
|
|
236
|
+
bottom: 50px;
|
|
237
|
+
left: 50%;
|
|
238
|
+
width: max-content;
|
|
239
|
+
z-index: 100;
|
|
240
|
+
display: flex;
|
|
241
|
+
gap: 20px;
|
|
242
|
+
|
|
243
|
+
.item {
|
|
244
|
+
width: 150px;
|
|
245
|
+
height: 220px;
|
|
246
|
+
flex-shrink: 0;
|
|
247
|
+
position: relative;
|
|
248
|
+
|
|
249
|
+
img {
|
|
250
|
+
width: 100%;
|
|
251
|
+
height: 100%;
|
|
252
|
+
object-fit: cover;
|
|
253
|
+
border-radius: 20px;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.content {
|
|
257
|
+
color: #fff;
|
|
258
|
+
position: absolute;
|
|
259
|
+
bottom: 10px;
|
|
260
|
+
left: 10px;
|
|
261
|
+
right: 10px;
|
|
262
|
+
|
|
263
|
+
.title {
|
|
264
|
+
font-weight: 500;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.description {
|
|
268
|
+
font-weight: 300;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* arrows */
|
|
275
|
+
.arrows {
|
|
276
|
+
position: absolute;
|
|
277
|
+
top: 80%;
|
|
278
|
+
right: 52%;
|
|
279
|
+
z-index: 100;
|
|
280
|
+
width: 300px;
|
|
281
|
+
max-width: 30%;
|
|
282
|
+
display: flex;
|
|
283
|
+
gap: 10px;
|
|
284
|
+
align-items: center;
|
|
285
|
+
|
|
286
|
+
button {
|
|
287
|
+
width: 40px;
|
|
288
|
+
height: 40px;
|
|
289
|
+
border-radius: 50%;
|
|
290
|
+
background-color: #eee4;
|
|
291
|
+
border: none;
|
|
292
|
+
color: #fff;
|
|
293
|
+
font-family: monospace;
|
|
294
|
+
font-weight: bold;
|
|
295
|
+
transition: 0.5s;
|
|
296
|
+
|
|
297
|
+
&:hover {
|
|
298
|
+
background-color: #fff;
|
|
299
|
+
color: #000;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.time {
|
|
305
|
+
position: absolute;
|
|
306
|
+
z-index: 1000;
|
|
307
|
+
width: 0%;
|
|
308
|
+
height: 3px;
|
|
309
|
+
background-color: #f1683a;
|
|
310
|
+
left: 0;
|
|
311
|
+
top: 0;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/* Slider carousel animations */
|
|
315
|
+
&.next {
|
|
316
|
+
.list {
|
|
317
|
+
.item {
|
|
318
|
+
&:nth-child(1) {
|
|
319
|
+
img {
|
|
320
|
+
width: 150px;
|
|
321
|
+
height: 220px;
|
|
322
|
+
position: absolute;
|
|
323
|
+
bottom: 50px;
|
|
324
|
+
left: 50%;
|
|
325
|
+
border-radius: 30px;
|
|
326
|
+
animation: showImage 0.5s linear 1 forwards;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.arrows {
|
|
333
|
+
button {
|
|
334
|
+
pointer-events: none;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.thumbnail {
|
|
339
|
+
animation: effectNext 0.5s linear 1 forwards;
|
|
340
|
+
|
|
341
|
+
.item {
|
|
342
|
+
&:nth-last-child(1) {
|
|
343
|
+
overflow: hidden;
|
|
344
|
+
animation: showThumbnail 0.5s linear 1 forwards;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.time {
|
|
350
|
+
animation: runningTime 3s linear 1 forwards;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
&.prev {
|
|
355
|
+
.list {
|
|
356
|
+
.item {
|
|
357
|
+
&:nth-child(2) {
|
|
358
|
+
z-index: 2;
|
|
359
|
+
|
|
360
|
+
img {
|
|
361
|
+
animation: outFrame 0.5s linear 1 forwards;
|
|
362
|
+
position: absolute;
|
|
363
|
+
bottom: 0;
|
|
364
|
+
left: 0;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.content {
|
|
368
|
+
.author,
|
|
369
|
+
.title,
|
|
370
|
+
.topic,
|
|
371
|
+
.des,
|
|
372
|
+
.buttons {
|
|
373
|
+
animation: contentOut 1.5s linear 1 forwards !important;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
img {
|
|
378
|
+
z-index: 100;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.arrows {
|
|
384
|
+
button {
|
|
385
|
+
pointer-events: none;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.thumbnail {
|
|
390
|
+
.item {
|
|
391
|
+
&:nth-child(1) {
|
|
392
|
+
overflow: hidden;
|
|
393
|
+
opacity: 0;
|
|
394
|
+
animation: showThumbnail 0.5s linear 1 forwards;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
.time {
|
|
399
|
+
animation: runningTime 3s linear 1 forwards;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
@keyframes showContent {
|
|
405
|
+
to {
|
|
406
|
+
transform: translateY(0px);
|
|
407
|
+
filter: blur(0px);
|
|
408
|
+
opacity: 1;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
@keyframes showImage {
|
|
413
|
+
to {
|
|
414
|
+
bottom: 0;
|
|
415
|
+
left: 0;
|
|
416
|
+
width: 100%;
|
|
417
|
+
height: 100%;
|
|
418
|
+
border-radius: 0;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
@keyframes showThumbnail {
|
|
423
|
+
from {
|
|
424
|
+
width: 0;
|
|
425
|
+
opacity: 0;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
@keyframes effectNext {
|
|
430
|
+
from {
|
|
431
|
+
transform: translateX(150px);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
@keyframes runningTime {
|
|
436
|
+
from {
|
|
437
|
+
width: 100%;
|
|
438
|
+
}
|
|
439
|
+
to {
|
|
440
|
+
width: 0;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
@keyframes outFrame {
|
|
445
|
+
to {
|
|
446
|
+
width: 150px;
|
|
447
|
+
height: 220px;
|
|
448
|
+
bottom: 50px;
|
|
449
|
+
left: 50%;
|
|
450
|
+
border-radius: 20px;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
@keyframes contentOut {
|
|
455
|
+
to {
|
|
456
|
+
transform: translateY(-150px);
|
|
457
|
+
filter: blur(20px);
|
|
458
|
+
opacity: 0;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
@media screen and (max-width: 678px) {
|
|
462
|
+
.slider-gallery .list .item .content {
|
|
463
|
+
padding-right: 0;
|
|
464
|
+
}
|
|
465
|
+
.slider-gallery .list .item .content .title {
|
|
466
|
+
font-size: 30px;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
</style>
|
package/nuxt.config.ts
CHANGED
package/package.json
CHANGED