import React from 'react'; import Tab from './Tab'; import ErrorBoundary from '../../../ErrorBoundary'; export default class Tabs extends React.PureComponent { constructor(props) { super(props); this.state = { currentTab: this.props.children[0].props.label }; } onClick = (tab) => { this.setState({ currentTab: tab }); }; render() { let className = 'sidebar'; let tabClass = 'tab-content'; let optionsText = (

{window.language.modals.main.title}

); if (this.props.navbar) { className = 'modalNavbar'; tabClass = ''; optionsText = ''; } return (
{this.props.children.map((child) => { if (child.props.label !== this.state.currentTab) return undefined; return child.props.children; })}
); } }