import { h, Component } from 'preact' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' import * as liveActions from '../live/actions' class Select extends Component { constructor(props){ super(props) this.handleChange = this.handleChange.bind(this) } handleChange(e){ clearTimeout(this.timeout) let new_value = e.target.value this.props.actions.set_param(this.props.name, new_value) } render() { const value = this.props.opt[this.props.name] const options = this.props.options.map((key,i) => { return ( ) }) return (
{this.props.children}
) } } function capitalize(s){ return (s || "").replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); }); } const mapStateToProps = state => ({ opt: state.live.opt, }) const mapDispatchToProps = (dispatch, ownProps) => ({ actions: bindActionCreators(liveActions, dispatch) }) export default connect(mapStateToProps, mapDispatchToProps)(Select)