From 8f885890e317ad28adf4da7810c515d238b2298f Mon Sep 17 00:00:00 2001 From: Ann Barmina Date: Wed, 31 Jul 2024 23:05:58 +0200 Subject: [PATCH] fix(esl-carousel): fix carousel empty state Co-authored-by: ala'n (Alexey Stsefanovich) --- src/modules/esl-carousel/core/esl-carousel.less | 8 ++++++++ .../esl-carousel/renderers/esl-carousel.grid.renderer.ts | 1 + 2 files changed, 9 insertions(+) diff --git a/src/modules/esl-carousel/core/esl-carousel.less b/src/modules/esl-carousel/core/esl-carousel.less index e5465f4ac..db5e13a76 100644 --- a/src/modules/esl-carousel/core/esl-carousel.less +++ b/src/modules/esl-carousel/core/esl-carousel.less @@ -44,6 +44,14 @@ esl-carousel { user-select: none; pointer-events: none; } + + &[empty] { + --esl-carousel-side-space: 0; + + [esl-carousel-slides] { + display: none; + } + } } /* Default carousel area styles */ diff --git a/src/modules/esl-carousel/renderers/esl-carousel.grid.renderer.ts b/src/modules/esl-carousel/renderers/esl-carousel.grid.renderer.ts index 59dc02a7d..55c6cdd30 100644 --- a/src/modules/esl-carousel/renderers/esl-carousel.grid.renderer.ts +++ b/src/modules/esl-carousel/renderers/esl-carousel.grid.renderer.ts @@ -29,6 +29,7 @@ export class ESLGridCarouselRenderer extends ESLDefaultCarouselRenderer { /** Count of fake slides to fill the last "row" or incomplete carousel state */ public get fakeSlidesCount(): number { + if (this.$carousel.$slides.length === 0) return 0; if (this.$carousel.$slides.length < this.count) { return this.count - this.$carousel.$slides.length; }