import React from 'react'; import classnames from 'classnames'; import { TranslateType } from 'translations'; import { Link } from 'react-router-dom'; import './SubTabs.scss'; export interface Tab { path: string; name: TranslateType; isDisabled?(props: SubTabProps | {}): boolean; render(props: SubTabProps | {}): React.ReactElement | null; } export interface Props { activeTab?: string; root: string; tabs: Tab[]; sideBar?: React.ReactElement | React.Component | React.StatelessComponent; subTabProps?: SubTabProps; onTabChange?(): void; } interface State { isOpenModal: boolean; } export default class SubTabs extends React.Component< Props, State > { public render() { const { tabs, sideBar } = this.props; const activeTab = this.props.activeTab || tabs[0].path; const tab = tabs.find(t => t.path === activeTab) || tabs[0]; const columnSize = sideBar ? 8 : 12; return (
{tabs.map(t => ( {t.name} ))}
{tab.render(this.props.subTabProps || {})}
{this.props.sideBar ? this.props.sideBar : null}
); } }