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!
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

wb-select.js 721B

1234567891011121314151617181920212223242526
  1. //
  2. // Copyright (C) Stanislaw Adaszewski, 2020
  3. // Contact: s.adaszewski@gmail.com
  4. // Website: https://adared.ch/wba
  5. // License: GNU Affero General Public License, Version 3
  6. //
  7. import { h, Component } from 'preact';
  8. class WBSelect extends Component {
  9. render({ value, options, onChange }) {
  10. return (
  11. <select class="form-control" onchange={ onChange }>
  12. { options.map(o => {
  13. const name = (typeof(o) === 'string') ? o : o.name;
  14. const id = (typeof(o) === 'object') ? o.id : name;
  15. return (
  16. <option selected={ (value === id) } value={ id }>{ name }</option>
  17. );
  18. }) }
  19. </select>
  20. );
  21. }
  22. }
  23. export default WBSelect;