import React, { Component, PropTypes } from 'react';
import { newEntry } from '../../actions/entryActions';
import Button from '../../components/Button';
import renderOption from '../../utils/renderOption';

export default class NewEntry extends Component {
  static propTypes = {
    dispatch: PropTypes.func,
  }

  constructor(props) {
    super(props);
    this.onSubmit = this.onSubmit.bind(this);
  }

  onSubmit(e) {
    e.preventDefault();
    this.props.dispatch(newEntry(this.title.value, this.section.value));
  }

  render() {
    const { sections, fields, params } = this.props;
    const sectionObj = sections.sections.find(sec => sec.slug === params.section);
    console.log(sectionObj);
    const sectionFields = fields.fields.filter(field => sectionObj.fields.indexOf(field._id) !== -1);

    console.log(sectionFields);

    return (
      <div>
        <form onSubmit={this.onSubmit}>
          <input type="text" name="title" ref={(r) => { this.title = r; }} />
          {sectionFields.map(field => renderOption(field))}
          <Button type="submit">Add Entry</Button>
        </form>
      </div>
    );
  }
}

@@ -304,16 +304,208 @@
 s.func,%0A
+    sections: PropTypes.object,%0A    fields: PropTypes.object,%0A    params: PropTypes.object.isRequired,%0A  %7D%0A%0A  static defaultProps = %7B%0A    dispatch: null,%0A    sections: null,%0A    fields: null,%0A
   %7D%0A%0A  c
@@ -864,37 +864,8 @@
 n);%0A
-    console.log(sectionObj);%0A
     
@@ -899,16 +899,23 @@
 s.fields
+%0A      
 .filter(
@@ -974,41 +974,8 @@
 );%0A%0A
-    console.log(sectionFields);%0A%0A
     

Fix eslint errors