<commit_before>import React    from 'react';
import _        from 'lodash';
import Feedback from './question_common/feedback';

const BOX_SIZES = {
  small: {
    expectedLines: 1,
    expectedLength: 50,
    maxStrings: 1,
  },
  medium: {
    expectedLines: 3,
    expectedLength: 500,
    maxStrings: 1,
  },
  large: {
    expectedLines: 5,
    expectedLength: 500,
    maxStrings: 1,
  }
};

function getBoxSize(lines) {
  return _.findKey(BOX_SIZES, boxSize => lines === boxSize.expectedLines) || 'large';
}

export default function ShortAnswer(props) {
  const { question } = props.item;
  const lines = question && question.expectedLines;

  function updateItem(e) {
    props.updateItem({
      question: { ...BOX_SIZES[e.target.value] }
    });
  }

  return (
    <div>
      <div className="c-question__answers c-short-answer__answers">
        <div className="c-dropdown c-dropdown--medium c-input-label--top">
          <label htmlFor="short-answer-size">Answer Box</label>
          <select
            value={getBoxSize(lines)}
            onChange={e => updateItem(e)}
            id="short-answer-size"
          >
            <option value="small">Small</option>
            <option value="medium">Medium</option>
            <option value="large">Large</option>
          </select>
        </div>

        <div className={`c-short-answer__example is-${getBoxSize(lines)}`}>
          <span>{_.capitalize(getBoxSize(lines))} Box</span>
        </div>
      </div>

      <Feedback />
    </div>
  );
}

ShortAnswer.propTypes = {
  item: React.PropTypes.shape({
    question: React.PropTypes.shape({
      lines: React.PropTypes.number
    })
  }),
  updateItem: React.PropTypes.func.isRequired
};
<commit_msg>Use single feedback for now. (#142)<commit_after>import React          from 'react';
import _              from 'lodash';
import SingleFeedback from './question_common/single_feedback';

const BOX_SIZES = {
  small: {
    expectedLines: 1,
    expectedLength: 50,
    maxStrings: 1,
  },
  medium: {
    expectedLines: 1,
    expectedLength: 200,
    maxStrings: 1,
  },
  large: {
    expectedLines: 5,
    expectedLength: 200,
    maxStrings: 1,
  }
};

function getBoxSize(lines) {
  return _.findKey(BOX_SIZES, boxSize => lines === boxSize.expectedLines) || 'large';
}

export default function ShortAnswer(props) {
  const { question } = props.item;
  const lines = question && question.expectedLines;

  function updateItem(e) {
    props.updateItem({
      question: { ...BOX_SIZES[e.target.value] }
    });
  }

  return (
    <div>
      <div className="c-question__answers c-short-answer__answers">
        <div className="c-dropdown c-dropdown--medium c-input-label--top">
          <label htmlFor="short-answer-size">Answer Box</label>
          <select
            value={getBoxSize(lines)}
            onChange={e => updateItem(e)}
            id="short-answer-size"
          >
            <option value="small">Small</option>
            <option value="medium">Medium</option>
            <option value="large">Large</option>
          </select>
        </div>

        <div className={`c-short-answer__example is-${getBoxSize(lines)}`}>
          <span>{_.capitalize(getBoxSize(lines))} Box</span>
        </div>
      </div>

      <SingleFeedback
        item={props.item}
        updateItem={props.updateItem}
      />
    </div>
  );
}

ShortAnswer.propTypes = {
  item: React.PropTypes.shape({
    question: React.PropTypes.shape({
      lines: React.PropTypes.number
    })
  }),
  updateItem: React.PropTypes.func.isRequired
};

{'fraction_non_alphanumeric': 0.14417435037720033, 'fraction_numerical': 0.00866163732886281, 'mean_word_length': 2.5270935960591134, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '377148', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1113, 'n_words': 209}