category-select.js 596 B

1234567891011121314151617181920212223242526
  1. // jshint ignore:start
  2. import React from 'react';
  3. export default function(props) {
  4. return (
  5. <select
  6. className={props.className || 'form-control'}
  7. disabled={props.disabled || false}
  8. id={props.id || null}
  9. onChange={props.onChange}
  10. value={props.value}
  11. >
  12. {props.choices.map((item) => {
  13. return (
  14. <option
  15. disabled={item.disabled || false}
  16. key={item.value}
  17. value={item.value}
  18. >
  19. {'- - '.repeat(item.level) + item.label}
  20. </option>
  21. );
  22. })}
  23. </select>
  24. );
  25. }