@@ -83,46 +83,49 @@ let CardScroll = React.createClass({
8383 onClick = { this . scrollCardsWrap ( { toLeft : true } ) } >
8484 < div className = { s . arrow } > </ div >
8585 </ div >
86- :null }
86+ :null }
87+
8788 { this . showArrows ( ) && this . canScrollRight ( ) ?
8889 < div className = { s . rightArrow }
8990 onClick = { this . scrollCardsWrap ( ) } >
9091 < div className = { s . arrow } > </ div >
91- </ div >
92- :null }
93- < div className = { s . container }
94- style = { { marginLeft : this . maxOffset , marginRight : this . maxOffset } }
95- ref = { updateContainer } >
96- { React . Children . map ( this . props . children , ( child , index ) => {
97- const offset = getOffset ( {
98- index,
99- firstVisibleIndex :currentCard ,
100- lastVisibleIndex :lastCard ,
101- visibleStack : this . props . visibleStack ,
102- stackSpace : this . props . stackSpace
103- } )
104- let position = offset
105- let zIndex = - currentCard + index
106- let className = "rcs-left-stack"
107- if ( offset == 0 ) {
108- position = ( index - currentCard ) * this . widths . card
109- if ( index == lastCard && currentCard != lastCard ) {
110- zIndex = 0
111- }
112- className = "rcs-center"
113- } else if ( offset > 0 ) {
114- position = offset + ( lastCard - currentCard ) * this . widths . card
115- zIndex = lastCard - index - 1
116- className = "rcs-right-stack"
92+ </ div >
93+ :null }
94+
95+
96+ < div className = { s . container }
97+ style = { { marginLeft : this . maxOffset , marginRight : this . maxOffset } }
98+ ref = { updateContainer } >
99+ { React . Children . map ( this . props . children , ( child , index ) => {
100+ const offset = getOffset ( {
101+ index,
102+ firstVisibleIndex :currentCard ,
103+ lastVisibleIndex :lastCard ,
104+ visibleStack : this . props . visibleStack ,
105+ stackSpace : this . props . stackSpace
106+ } )
107+ let position = offset
108+ let zIndex = - currentCard + index
109+ let className = "rcs-left-stack"
110+ if ( offset == 0 ) {
111+ position = ( index - currentCard ) * this . widths . card
112+ if ( index == lastCard && currentCard != lastCard ) {
113+ zIndex = 0
117114 }
118- const style = { left : position , zIndex}
119- return (
120- < div className = { `${ className } ${ childrenClass } ` } style = { style } ref = { index == 0 && updateChild } >
121- { child }
122- </ div >
123- ) ;
124- } ) }
125- </ div >
115+ className = "rcs-center"
116+ } else if ( offset > 0 ) {
117+ position = offset + ( lastCard - currentCard ) * this . widths . card
118+ zIndex = lastCard - index - 1
119+ className = "rcs-right-stack"
120+ }
121+ const style = { left : position , zIndex}
122+ return (
123+ < div className = { `${ className } ${ childrenClass } ` } style = { style } ref = { index == 0 && updateChild } >
124+ { child }
125+ </ div >
126+ ) ;
127+ } ) }
128+ </ div >
126129 </ div >
127130 )
128131 } ,
0 commit comments