import {
	observer
} from 'mobx-react';
import {
	WeaDialog,
} from 'ecCom';
import {
	Loading,
} from '../../public/learn';
import DialogForm from './DialogForm';

@observer
export default class Dialog extends React.Component {
	constructor(props) {
		super(props);
	}

	render() {
		const {
			store
		} = this.props, {
			DIALOG,
			dialog,
			dialogButtons,
		} = store;

		return (
			<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@pw7kkv`}
				{...DIALOG}
				{...dialog}
				buttons={dialogButtons}
			>
			{
				dialog.loading ? <Loading ecId={`${this && this.props && this.props.ecId || ''}_Loading@odnwvu`} /> :	<DialogForm ecId={`${this && this.props && this.props.ecId || ''}_DialogForm@x1kv8p`} store={store}/>
			}
			</WeaDialog>
		);
	}
}