import _ from 'lodash';
import classnames from 'classnames';
import React from 'react';
import CustomScrollbars from '../ui/CustomScrollbars';
import ModalActions from './ModalActions';
import ModalTabs from './ModalTabs';
const METHODS_TO_BIND = ['handleTabChange'];
export default class Modal extends React.Component {
constructor() {
super();
this.state = {
activeTabId: null
};
METHODS_TO_BIND.forEach((method) => {
this[method] = this[method].bind(this);
});
}
getActiveTabId() {
if (this.state.activeTabId) {
return this.state.activeTabId;
}
return Object.keys(this.props.tabs)[0];
}
handleTabChange(tab) {
this.setState({activeTabId: tab.id});
}
handleMenuWrapperClick(event) {
event.stopPropagation();
}
render() {
let footer = null;
let contentClasses = classnames('modal__content__wrapper',
`modal--align-${this.props.alignment}`, `modal--size-${this.props.size}`, {
'modal--horizontal': this.props.orientation === 'horizontal',
'modal--vertical': this.props.orientation === 'vertical',
'modal--tabs-in-header': !this.props.tabsInBody,
'modal--tabs-in-body': this.props.tabsInBody
}, this.props.classNames);
let modalBody = [this.props.content];
let modalHeader = [this.props.heading];
let headerClasses = classnames('modal__header', {
'has-tabs': this.props.tabs
});
let tabs = null;
if (this.props.tabs) {
let activeTabId = this.getActiveTabId();
let activeTab = this.props.tabs[activeTabId];
let ModalContentComponent = activeTab.content;
let modalContentData = activeTab.props;
let tabs = (