{"size": 887, "ext": "js", "max_stars_repo_path": "src/components/dropdown/index.js", "max_stars_repo_name": "damianfabian/pathfinder", "max_stars_repo_stars_event_min_datetime": "2017-05-08T21:42:11.000Z", "max_stars_repo_stars_event_max_datetime": "2017-05-08T21:42:11.000Z", "max_issues_repo_path": "src/components/dropdown/index.js", "max_issues_repo_name": "damianfabian/pathfinder", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/dropdown/index.js", "max_forks_repo_name": "damianfabian/pathfinder", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.0882352941, "max_line_length": 125, "alphanum_fraction": 0.5783540023}
import React, { Component, PropTypes } from 'react';
import classnames from 'classnames'

class DropDown extends Component {
    render () {
        return (
            <select
              className={classnames('dropdown', this.props.className)}
              name={this.props.name}
              onChange={this.props.onChange}
            >
                <option value=''>{this.props.placeholder}</option>
                {
                    this.props.data && this.props.data.map(el => <option value={el.value} key={el.value}>{el.label}</option>)
                }
            </select>
        )
    }
}

DropDown.propTypes = {
    data: PropTypes.array.isRequired,
    className: PropTypes.string,
    name: PropTypes.string,
    placeholder: PropTypes.string,
    onChange: PropTypes.func
}

DropDown.defaultProps = {
    placeholder: 'Select one'
}

export default DropDown
