SimpleSelect.tsx 728 B

12345678910111213141516171819202122232425262728
  1. import React, { SFC } from 'react';
  2. interface Props {
  3. onValueChange: any;
  4. options: any;
  5. value: string;
  6. label: string;
  7. }
  8. const SimpleSelect: SFC<Props> = props => {
  9. const { label, onValueChange, value, options } = props;
  10. return (
  11. <div className="gf-form max-width-21">
  12. <span className="gf-form-label width-10">{label}</span>
  13. <div className="gf-form-select-wrapper max-width-10">
  14. <select className="gf-form-input" required onChange={onValueChange} value={value}>
  15. {options.map(({ value, name }, i) => (
  16. <option key={i} value={value}>
  17. {name}
  18. </option>
  19. ))}
  20. </select>
  21. </div>
  22. </div>
  23. );
  24. };
  25. export default SimpleSelect;