import React from 'react'; import classNames from 'classnames'; import { SessionButton } from './SessionButton'; import { SessionIcon, SessionIconSize, SessionIconType } from './icon'; import { NotificationCountSize, SessionNotificationCount, } from './SessionNotificationCount'; const Tab = ({ isSelected, label, onSelect, type, }: { isSelected: boolean; label: string; onSelect?: (event: number) => void; type: number; }) => { const handleClick = onSelect ? () => { onSelect(type); } : undefined; return (

{label}

); }; interface Props { onTabSelected: any; selectedTab: number; labels: Array; notificationCount?: number; buttonLabel?: string; buttonIcon?: SessionIconType; buttonClicked?: any; } interface State { selectedTab: number; } export class LeftPaneSectionHeader extends React.Component { constructor(props: any) { super(props); this.state = { selectedTab: 0 }; } public render() { return this.renderTabs(); } private renderTabs() { const { selectedTab } = this.state; const { labels, buttonLabel, buttonIcon, buttonClicked, notificationCount, } = this.props; const hasButton = buttonLabel || buttonIcon; const children = []; //loop to create children for (let i = 0; i < labels.length; i++) { children.push( ); } if (hasButton && !notificationCount) { const buttonContent = buttonIcon ? ( ) : ( buttonLabel ); const button = ( {buttonContent} ); children.push(button); } else if (buttonLabel && notificationCount && notificationCount > 0) { children.push(
); } else if (notificationCount && notificationCount > 0) { children.push( ); } // Create the parent and add the children return
{children}
; } private readonly handleTabSelect = (tabType: number): void => { this.setState({ selectedTab: tabType, }); if (this.props.onTabSelected) { this.props.onTabSelected(tabType); } }; }