From ff695f200fe38122a599bb90b7aabdfe84c5503a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Fri, 9 Jun 2023 14:04:22 +0300 Subject: [PATCH] Refactor #3965 - Update for Carousel --- components/lib/carousel/BaseCarousel.vue | 43 +++++++++++++++---- components/lib/carousel/Carousel.vue | 53 ++++++------------------ 2 files changed, 47 insertions(+), 49 deletions(-) diff --git a/components/lib/carousel/BaseCarousel.vue b/components/lib/carousel/BaseCarousel.vue index e0c1aeaca..36f720af3 100644 --- a/components/lib/carousel/BaseCarousel.vue +++ b/components/lib/carousel/BaseCarousel.vue @@ -75,11 +75,22 @@ const styles = ` `; const classes = { - root: ({ instance }) => ['p-carousel p-component', { 'p-carousel-vertical': instance.isVertical(), 'p-carousel-horizontal': !instance.isVertical() }], + root: ({ instance }) => [ + 'p-carousel p-component', + { + 'p-carousel-vertical': instance.isVertical(), + 'p-carousel-horizontal': !instance.isVertical() + } + ], header: 'p-carousel-header', - content: ({ props }) => ['p-carousel-content ', props.contentClass], - container: ({ props }) => ['p-carousel-container', props.containerClass], - previousButton: ({ instance }) => ['p-carousel-prev p-link', { 'p-disabled': instance.backwardIsDisabled }], + content: 'p-carousel-content', + container: 'p-carousel-container', + previousButton: ({ instance }) => [ + 'p-carousel-prev p-link', + { + 'p-disabled': instance.backwardIsDisabled + } + ], previousButtonIcon: 'p-carousel-next-icon', itemsContent: 'p-carousel-items-content', itemsContainer: 'p-carousel-items-container', @@ -87,18 +98,32 @@ const classes = { 'p-carousel-item p-carousel-item-cloned', { 'p-carousel-item-active': totalShiftedItems * -1 === value.length + d_numVisible, - 'p-carousel-item-start': 0 === index, + 'p-carousel-item-start': index === 0, 'p-carousel-item-end': value.slice(-1 * d_numVisible).length - 1 === index } ], item: ({ instance, index }) => [ 'p-carousel-item', - { 'p-carousel-item-active': instance.firstIndex() <= index && instance.lastIndex() >= index, 'p-carousel-item-start': instance.firstIndex() === index, 'p-carousel-item-end': instance.lastIndex() === index } + { + 'p-carousel-item-active': instance.firstIndex() <= index && instance.lastIndex() >= index, + 'p-carousel-item-start': instance.firstIndex() === index, + 'p-carousel-item-end': instance.lastIndex() === index + } + ], + nextButton: ({ instance }) => [ + 'p-carousel-next p-link', + { + 'p-disabled': instance.forwardIsDisabled + } ], - nextButton: ({ instance }) => ['p-carousel-next p-link', { 'p-disabled': instance.forwardIsDisabled }], nextButtonIcon: 'p-carousel-prev-icon', - indicators: ({ props }) => ['p-carousel-indicators p-reset', props.indicatorsContentClass], - indicator: ({ instance, i }) => ['p-carousel-indicator', { 'p-highlight': instance.d_page === i }], + indicators: 'p-carousel-indicators p-reset', + indicator: ({ instance, index }) => [ + 'p-carousel-indicator', + { + 'p-highlight': instance.d_page === index + } + ], indicatorButton: 'p-link', footer: 'p-carousel-footer' }; diff --git a/components/lib/carousel/Carousel.vue b/components/lib/carousel/Carousel.vue index 50708c4ce..7980ca94d 100755 --- a/components/lib/carousel/Carousel.vue +++ b/components/lib/carousel/Carousel.vue @@ -3,8 +3,8 @@
-
-
+
+
-
    -
  • +
      +