{"size": 832, "ext": "js", "max_stars_repo_path": "src/index.js", "max_stars_repo_name": "stierma1/class-gui", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/index.js", "max_issues_repo_name": "stierma1/class-gui", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/index.js", "max_forks_repo_name": "stierma1/class-gui", "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": 28.6896551724, "max_line_length": 147, "alphanum_fraction": 0.6346153846}
import React from "react"
import t from "tcomb-form"

export default React.createClass({
  onSubmit: function(evt) {
    evt.preventDefault()
    const value = this.refs.form.getValue()
    if (value) {
      console.log(value)
    }
  },

  render: function(){
    var button = null;
    if(!this.props.readOnly){

      button = <div className="form-group">
        <button type="submit" className="btn btn-primary">Save</button>
        {this.props.allowDelete ? <button onClick={(this.props.onDelete && this.props.onDelete.bind(this))} className="btn">Delete</button> : null}
      </div>
    }

    return (<form onSubmit={(this.props.onSubmit && this.props.onSubmit.bind(this)) || this.onSubmit}>
      <t.form.Form ref="form" value={this.props.value} type={this.props.clazz.getSchema()} />
      {button}
    </form>)
  }
})
