Add tabs in AddTorrent modal

This commit is contained in:
John Furrow
2016-02-15 13:14:38 -08:00
parent 96e008d725
commit ce94ac35d1
15 changed files with 501 additions and 161 deletions

View File

@@ -0,0 +1,38 @@
import classnames from 'classnames';
import React from 'react';
export default class ModalTabs extends React.Component {
handleTabClick(tab) {
if (this.props.onTabChange) {
this.props.onTabChange(tab);
}
}
render() {
let tabs = Object.keys(this.props.tabs).map((tabId, index) => {
let currentTab = this.props.tabs[tabId];
currentTab.id = tabId;
let classes = classnames('modal__tab', {
'is-active': tabId === this.props.activeTabId
});
return (
<li className={classes} key={index}
onClick={this.handleTabClick.bind(this, currentTab)}>
{currentTab.label}
</li>
);
});
return (
<ul className="modal__tabs">
{tabs}
</ul>
);
}
}
ModalTabs.defaultProps = {
tabs: []
};