{"size": 740, "ext": "js", "max_stars_repo_path": "src/components/FeedbackChoices/index.js", "max_stars_repo_name": "rahulchrty/bliss", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/FeedbackChoices/index.js", "max_issues_repo_name": "rahulchrty/bliss", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/FeedbackChoices/index.js", "max_forks_repo_name": "rahulchrty/bliss", "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": 22.4242424242, "max_line_length": 85, "alphanum_fraction": 0.6027027027}
import PropTypes from 'prop-types';
import React from 'react';
import { useTranslation } from 'react-i18next';


/**
 * Render choices for the user to submit feedback.
 */
export default function FeedbackChoices({ onSelect }) {

  const { t }  = useTranslation('feedback');
  const choices = t('choices', {defaultValue: []});

  const onClick = index => () => onSelect(index);

  return !!choices.length && (
    <div className="dydu-feedback-choices">
      <ul>
        {choices.map((choice, index) => (
          <li key={index}>
            <span children={choice} className="dydu-link" onClick={onClick(index)} />
          </li>
        ))}
      </ul>
    </div>
  );
}


FeedbackChoices.propTypes = {
  onSelect: PropTypes.func,
};
