IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
537B

  1. import { h, Component } from 'preact';
  2. class WBSelect extends Component {
  3. render({ value, options, onChange }) {
  4. return (
  5. <select class="form-control" onchange={ onChange }>
  6. { options.map(o => {
  7. const name = (typeof(o) === 'string') ? o : o.name;
  8. const id = (typeof(o) === 'object') ? o.id : name;
  9. return (
  10. <option selected={ (value === id) } value={ id }>{ name }</option>
  11. );
  12. }) }
  13. </select>
  14. );
  15. }
  16. }
  17. export default WBSelect;