Created
December 16, 2015 19:47
-
-
Save criso/4629d80f94fe588e1262 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const tabBtns = this.state.tabs.map((tab, index) => { | |
const tabKey = tab.key; | |
const style = this.buildMotionStyle(tabKey); | |
const isActive = this.props.selectedTabKey === tabKey; | |
return ( | |
<Motion style={style} key={index}> | |
{ | |
({scale, x, cursor, zIndex}) => { | |
return React.cloneElement(tab, { | |
key: tabKey, | |
onMouseDown: this._onMouseDown.bind(null, tabKey, x), | |
style: { | |
width : liWidth, | |
cursor : cursor, | |
transform : `translate3d(${x}px, 0, 0) scale(${scale})`, | |
WebkitTransform : `translate3d(${x}px, 0, 0) scale(${scale})`, | |
zIndex : isActive ? 300 : zIndex | |
}, | |
isActive : isActive, | |
onClose : this._onCloseTab.bind(null, tabKey) | |
}); | |
} | |
} | |
</Motion> | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment