Skip to content

Commit

Permalink
feat(storefront): New prop hasControls to <Carousel>
Browse files Browse the repository at this point in the history
Higging controls by default when not more than one slide
  • Loading branch information
leomp12 committed Oct 6, 2023
1 parent deb58ff commit 017d5c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/storefront/src/lib/components/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface Props {
index?: number;
autoplay?: number; // milliseconds
axis?: 'x' | 'y';
hasControls?: boolean
}
const props = withDefaults(defineProps<Props>(), {
Expand Down Expand Up @@ -240,10 +241,10 @@ provide(carouselKey, {
activeIndex,
}"
>
<CarouselControl is-prev :axis="axis">
<CarouselControl v-show="slideSizes.length > 1 || hasControls" is-prev>
<slot name="previous" />
</CarouselControl>
<CarouselControl :axis="axis">
<CarouselControl v-show="slideSizes.length > 1 || hasControls">
<slot name="next" />
</CarouselControl>
</slot>
Expand Down

0 comments on commit 017d5c9

Please sign in to comment.