File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -154,9 +154,10 @@ export default class Carousel extends LitElement {
154154 @property ( { type : String , attribute : 'dot-appearance' } )
155155 dotAppearance : 'circle' | 'bar' = 'bar' ;
156156
157- @property ( { type : String , attribute : 'scroll-button -position' } )
157+ @property ( { type : String , attribute : 'scroll-buttons -position' } )
158158 scrollButtonsPosition : 'inside' | 'outside' = 'inside' ;
159159
160+ @query ( '.scroll-buttons' ) scrollButtons ! : HTMLElement ;
160161 @query ( '.button-previous' ) previousBtn ! : HTMLButtonElement ;
161162 @query ( '.button-next' ) nextBtn ! : HTMLButtonElement ;
162163 @query ( '.container' ) container ! : HTMLSlotElement ;
@@ -246,9 +247,12 @@ export default class Carousel extends LitElement {
246247 }
247248
248249 protected updateNavigation ( ) {
250+ const canScroll = this . embla . canScrollPrev ( ) || this . embla . canScrollNext ( ) ;
251+
249252 // Set disabled state for next/previous buttons
250253 this . previousBtn . toggleAttribute ( 'disabled' , ! this . embla . canScrollPrev ( ) ) ;
251254 this . nextBtn . toggleAttribute ( 'disabled' , ! this . embla . canScrollNext ( ) ) ;
255+ this . scrollButtons . classList . toggle ( 'scroll-buttons--disabled' , ! canScroll ) ;
252256
253257 // Set active state for dots
254258 if ( this . withDots ) {
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ export const MoreProducts: Story = {
179179 < zx-carousel
180180 drag-free
181181 with-scrollbar
182- scroll-button -position ="outside "
182+ scroll-buttons -position ="outside "
183183 style ="--slide-size: calc(100% / 3); --slide-gap: 1rem "
184184 >
185185 ${ repeat (
Original file line number Diff line number Diff line change @@ -107,10 +107,12 @@ export default css`
107107 */
108108
109109 display : flex;
110- gap : 6 px ;
110+ gap : 8 px ;
111111 justify-content : end;
112+ padding-block : 8px ;
112113 }
113114
115+ .scroll-buttons--disabled ,
114116 .inactive .scroll-buttons {
115117 display : none;
116118 }
@@ -143,10 +145,6 @@ export default css`
143145 z-index : 1 ;
144146 }
145147
146- .scroll-buttons--outside .button-previous ,
147- .scroll-buttons--outside .button-next {
148- }
149-
150148 .scroll-buttons--inside .button-previous {
151149 left : var (--button-offset );
152150 }
You can’t perform that action at this time.
0 commit comments