{"size": 989, "ext": "js", "max_stars_repo_path": "src/components/formItem/formItem.js", "max_stars_repo_name": "starsy/weform", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/formItem/formItem.js", "max_issues_repo_name": "starsy/weform", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/formItem/formItem.js", "max_forks_repo_name": "starsy/weform", "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": 19.0192307692, "max_line_length": 59, "alphanum_fraction": 0.6531850354}
import { Component, PropTypes } from 'labrador-immutable';
import { bindActionCreators } from 'redux';
import { connect } from 'labrador-redux';
import loglevel from 'loglevel';

let log = loglevel.getLogger('form');

const { string, func } = PropTypes;

class FormItem extends Component {
  static propTypes = {
    id: string,
    title: string,
    url: string,
    onRemove: func,
  };

  constructor(props) {
    super(props);
  }
  
  handleRemove() {
    this.props.onRemove(this.props.id);
  }

  handleShowForm() {
    wx.navigateTo({ url: '/pages/form/' + this.props.id });
  }
  
}

const mapStateToProps = (state) => {
  log.info("in map state to props: ", state);
  return {
    login: state.login,
    table: state.form.table,
  };
};

const mapDispatchToProps = (dispatch) => {
  log.info("in map dispatch to props: ");
  return bindActionCreators({
    get: FormActions.get,
  }, dispatch);
};

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(FormItem);

