|
12345678910111213141516171819 |
- 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;
|