|
- //
- // Copyright (C) Stanislaw Adaszewski, 2020
- // Contact: s.adaszewski@gmail.com
- // Website: https://adared.ch/wba
- // License: GPLv3
- //
-
- import { h, Component } from 'preact';
-
- class WBSelect extends Component {
- render({ value, options, onChange }) {
- return (
- <select class="form-control" onchange={ onChange }>
- { options.map(o => {
- const name = (typeof(o) === 'string') ? o : o.name;
- const id = (typeof(o) === 'object') ? o.id : name;
- return (
- <option selected={ (value === id) } value={ id }>{ name }</option>
- );
- }) }
- </select>
- );
- }
- }
-
- export default WBSelect;
|