Skip to content

Commit b37528c

Browse files
committed
fix(carousel): simplify carousel instance retrieval in slide component
1 parent dd71e9e commit b37528c

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/components/carousel/carousel-slide.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,34 +49,26 @@ export default class IgcCarouselSlideComponent extends LitElement {
4949
}
5050
);
5151

52-
private get _carouselInstance(): IgcCarouselComponent | undefined {
53-
return this._carousel ?? this._context.value;
54-
}
55-
5652
protected get _index(): number {
57-
return this._carouselInstance
58-
? this._carouselInstance.slides.indexOf(this)
59-
: 0;
53+
return this._carousel ? this._carousel.slides.indexOf(this) : 0;
6054
}
6155

6256
protected get _total(): number {
63-
return this._carouselInstance ? this._carouselInstance.slides.length : 0;
57+
return this._carousel ? this._carousel.slides.length : 0;
6458
}
6559

6660
protected get _animation() {
67-
const animation = this._carouselInstance?.animationType ?? 'slide';
61+
const animation = this._carousel?.animationType ?? 'slide';
6862

6963
if (animation === 'slide') {
70-
return this._carouselInstance?.vertical ? 'slideVer' : 'slideHor';
64+
return this._carousel?.vertical ? 'slideVer' : 'slideHor';
7165
}
7266

7367
return animation;
7468
}
7569

7670
protected get _labelFormat(): string {
77-
return this._carouselInstance
78-
? this._carouselInstance.slidesLabelFormat
79-
: '';
71+
return this._carousel ? this._carousel.slidesLabelFormat : '';
8072
}
8173

8274
/**

0 commit comments

Comments
 (0)