2 * Copyright 2003-present Greg Hurrell. All rights reserved.
3 * Licensed under the terms of the MIT license.
8 import PropTypes from 'prop-types';
9 import React from 'react';
13 } from './Field.react';
15 export default class DynamicField extends React.Component {
17 initialBase: PropTypes.number,
18 onValueChange: PropTypes.func.isRequired,
24 this.state = {base: props.initialBase};
27 _onChange = event => {
28 const base = parseInt(event.target.value, 10);
29 this.setState({base});
34 for (let i = 2; i <= 36; i++) {
36 <option key={i} value={i}>Base {i}</option>
44 <label className="hextrapolate-row">
45 <span className="hextrapolate-base">
47 onChange={this._onChange}
48 value={this.state.base}>
49 {this._renderOptions()}
53 base={this.state.base}
54 onValueChange={this.props.onValueChange}
55 value={this.props.value}