-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathCarouselContent.vue
More file actions
54 lines (45 loc) · 1.07 KB
/
CarouselContent.vue
File metadata and controls
54 lines (45 loc) · 1.07 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
<script setup lang="ts">
import { useCarousel } from './useCarousel';
import type { WithClassAsProps } from './interface';
defineOptions({
inheritAttrs: false,
});
const props = defineProps<WithClassAsProps>();
const { carouselRef, orientation } = useCarousel();
</script>
<template>
<div ref="carouselRef" class="carousel-container">
<div
:class="['carousel-content', orientation === 'horizontal' ? 'horizontal' : 'vertical', props.class]"
v-bind="$attrs"
>
<slot />
</div>
</div>
</template>
<style lang="scss" scoped>
.carousel-content {
display: flex;
}
.carousel-content.horizontal {
margin-left: -4rem;
}
.carousel-content.vertical {
margin-top: -1rem;
flex-direction: column;
}
.scene {
--buff: 3rem;
height: 100%;
width: 100%;
mask:
linear-gradient(to right, transparent, white var(--buff) calc(100% - var(--buff)), transparent),
linear-gradient(to left, transparent, white var(--buff) calc(100% - var(--buff)), transparent);
mask-composite: intersect;
}
@media (max-width: 768px) {
.carousel-content.horizontal {
margin-left: 0;
}
}
</style>