mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-27 09:15:29 +01:00
Use min and max from spec in number field
This commit is contained in:
parent
bc05c11cef
commit
2a34424898
2 changed files with 10 additions and 2 deletions
|
@ -25,12 +25,20 @@ class NumberField extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let stepSize = null
|
||||
if(this.props.max && this.props.min) {
|
||||
stepSize = (this.props.max - this.props.min) / 10
|
||||
}
|
||||
|
||||
return <input
|
||||
style={{
|
||||
...input.input,
|
||||
...this.props.style
|
||||
}}
|
||||
type="number"
|
||||
min={this.props.min}
|
||||
max={this.props.max}
|
||||
step={stepSize}
|
||||
name={this.props.name}
|
||||
placeholder={this.props.default}
|
||||
value={this.props.value}
|
||||
|
|
|
@ -49,8 +49,8 @@ export default class SpecField extends React.Component {
|
|||
<NumberField
|
||||
{...commonProps}
|
||||
default={this.props.fieldSpec.default}
|
||||
min={this.props.fieldSpec.min}
|
||||
max={this.props.fieldSpec.max}
|
||||
min={this.props.fieldSpec.minimum}
|
||||
max={this.props.fieldSpec.maximum}
|
||||
unit={this.props.fieldSpec.unit}
|
||||
/>
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue