// @flow
import React from 'react'
import { DropdownInput, DropDownWrapper } from './Wrapper'

type Props = {
  options: Array<Object>,
  handleChange: Function,
  value: string,
  name: string
}

const Dropdown = ({ options, handleChange, value, name }: Props) => (
  <DropDownWrapper>
    <DropdownInput name={name} value={value} onChange={handleChange}>
      {options.map(element => (
        <option value={element.value} key={element.value}>
          {element.name}
        </option>
      ))}
    </DropdownInput>
  </DropDownWrapper>
)

export default Dropdown
