Skip to content

Commit e90858b

Browse files
profile-slider fix
1 parent a010fad commit e90858b

2 files changed

Lines changed: 80 additions & 36 deletions

File tree

src/components/UI/UISlider.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ defineProps<{
2626
</SwiperSlide>
2727
</template>
2828
<template v-if="$slots.pagination">
29-
<div class="swiper-pagination-wrapper">
29+
<div v-if="slides && slides.length > 1" class="swiper-pagination-wrapper">
3030
<slot name="pagination" />
3131
</div>
3232
</template>

src/views/home-view.vue

Lines changed: 79 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ const swiperOptions = {
3232
spaceBetween: 8,
3333
speed: 900,
3434
pagination: {
35-
el: '.profile-slider__pagination',
36-
bulletClass: 'profile-slider__pagination-bullet',
37-
bulletActiveClass: 'profile-slider__pagination-bullet-active',
35+
el: '.home-view__profile-slider-pagination',
36+
bulletClass: 'home-view__profile-slider-pagination-bullet',
37+
bulletActiveClass: 'home-view__profile-slider-pagination-bullet-active',
3838
clickable: true
3939
},
4040
keyboard: true,
@@ -48,31 +48,38 @@ const swiperOptions = {
4848
<div class="home-view__about-inner">
4949
<div class="home-view__about-left-side">
5050
<div class="home-view__about-left-side-inner">
51-
<UISlider class="profile-slider" :modules="modules" :swiper-options="swiperOptions" :slides="profile.photos">
52-
<template #slider-content="{ slide }">
53-
<a
54-
class="home-view__about-img-link glightbox"
55-
:href="slide.url"
56-
>
57-
<div class="home-view__about-img-wrapper">
58-
<img
59-
:src="slide.url"
60-
:alt="slide.alt"
61-
width="350px"
62-
height="350px"
63-
/>
51+
<div class="home-view__profile-slider-wrapper">
52+
<UISlider
53+
class="home-view__profile-slider"
54+
:modules="modules"
55+
:swiper-options="swiperOptions"
56+
:slides="profile.photos"
57+
>
58+
<template #slider-content="{ slide }">
59+
<a
60+
class="home-view__about-img-link glightbox"
61+
:href="slide.url"
62+
>
63+
<div class="home-view__about-img-wrapper">
64+
<img
65+
:src="slide.url"
66+
:alt="slide.alt"
67+
width="280px"
68+
height="280px"
69+
/>
70+
</div>
71+
</a>
72+
</template>
73+
<template #pagination>
74+
<div
75+
v-if="profile.photos && profile.photos.length >= 1"
76+
class="home-view__profile-slider-pagination swiper-pagination"
77+
>
78+
<span class="visually-hidden">Пагинация</span>
6479
</div>
65-
</a>
66-
</template>
67-
<template #pagination>
68-
<div
69-
v-if="profile.photos && profile.photos.length >= 1"
70-
class="profile-slider__pagination swiper-pagination"
71-
>
72-
<span class="visually-hidden">Пагинация</span>
73-
</div>
74-
</template>
75-
</UISlider>
80+
</template>
81+
</UISlider>
82+
</div>
7683

7784
<div class="home-view__about-left-side-inner-content">
7885
<p class="home-view__about-name s1">{{ profile.name }}</p>
@@ -243,16 +250,53 @@ const swiperOptions = {
243250
}
244251
}
245252
}
246-
}
247253
248-
.profile-slider {
249-
margin: 0 0 32px;
250-
width: 350px;
251-
height: 350px;
252-
overflow: hidden;
254+
&__profile-slider-wrapper {
255+
width: 350px;
256+
height: 350px;
257+
display: flex;
258+
justify-content: center;
259+
align-items: center;
260+
overflow: hidden;
261+
}
262+
263+
&__profile-slider {
264+
margin: 0 0 32px;
265+
padding-bottom: 30px;
266+
267+
@media (min-width: variables.$desktop) {
268+
margin: 0 32px 0 0;
269+
}
270+
}
271+
272+
&__profile-slider-pagination {
273+
margin-top: 12px;
274+
display: flex;
275+
justify-content: center;
276+
}
277+
278+
&__profile-slider-pagination-bullet {
279+
margin-right: 6px;
280+
display: block;
281+
width: 10px;
282+
height: 10px;
283+
background-color: variables.$color-vue-bg;
284+
border-radius: 50%;
253285
254-
@media (min-width: variables.$desktop) {
255-
margin: 0 32px 0 0;
286+
&:last-child {
287+
margin-right: 0;
288+
}
256289
}
290+
291+
&__profile-slider-pagination-bullet-active {
292+
background-color: variables.$color-vue;
293+
}
294+
}
295+
296+
.slider__slide {
297+
width: 280px;
298+
height: 280px;
299+
display: flex;
300+
justify-content: center;
257301
}
258302
</style>

0 commit comments

Comments
 (0)