{"size": 1142, "ext": "js", "max_stars_repo_path": "src/components/widgetComponent/widgetComponent.js", "max_stars_repo_name": "hcbl1212/up_board_analytic_widget", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/widgetComponent/widgetComponent.js", "max_issues_repo_name": "hcbl1212/up_board_analytic_widget", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/widgetComponent/widgetComponent.js", "max_forks_repo_name": "hcbl1212/up_board_analytic_widget", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.3777777778, "max_line_length": 104, "alphanum_fraction": 0.5814360771}
import React, { Component } from 'react';

let TextWidget = ''; 
const widgets = {};

export default class WidgetComponent extends Component {

	constructor(props){
		super(props);
		this.state = {
			isComponentDone: false
		}
	}

	 componentWillMount() {
        const that = this;
        window.definejs = window.define;
        window.requirejs([`${this.props.widgetName}`], (TextWidgetImported) => {
            widgets[`${this.props.widgetName}`] = TextWidgetImported.createComponent(React, Component);
            that.setState({ isComponentDone: true });
        });
    }

	render(){

        TextWidget = widgets[`${this.props.widgetName}`];
        let widgetWrapper = '';

        if (this.state.isComponentDone) {
        	widgetWrapper = <TextWidget
        		changeWidgetText={this.props.changeWidgetText}
            widgetData={this.props.widgetData}
	        	widgetStyle={this.props.widgetStyle}
	        	widgetText={this.props.widgetText}
	        	mode={this.props.mode}
        	/>
        }
		return(
			<div style={{height:'100%'}}>
				{widgetWrapper}
			</div>
		)
	}
}
