Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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