SimpleDropdown.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React, { SFC } from 'react';
  2. interface Props {
  3. onValueChange: any;
  4. options: any;
  5. value: string;
  6. label: string;
  7. }
  8. const SimpleDropdown: SFC<Props> = props => {
  9. return (
  10. <div className="gf-form max-width-21">
  11. <span className="gf-form-label width-7">{props.label}</span>
  12. <div className="gf-form-select-wrapper max-width-14">
  13. <select className="gf-form-input" required onChange={props.onValueChange} value={props.value}>
  14. {props.options.map((qt, i) => (
  15. <option key={i} value={qt}>
  16. {qt}
  17. </option>
  18. ))}
  19. </select>
  20. </div>
  21. </div>
  22. );
  23. };
  24. export const KeyValueDropdown: SFC<Props> = props => {
  25. return (
  26. <div className="gf-form max-width-21">
  27. <span className="gf-form-label width-7">{props.label}</span>
  28. <div className="gf-form-select-wrapper max-width-14">
  29. <select className="gf-form-input" required onChange={props.onValueChange} value={props.value}>
  30. {props.options.map((qt, i) => (
  31. <option key={i} value={qt.value}>
  32. {qt.name}
  33. </option>
  34. ))}
  35. </select>
  36. </div>
  37. </div>
  38. );
  39. };
  40. export default SimpleDropdown;