mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 17:11:17 +01:00
Moved data-wd-key onto element
This commit is contained in:
parent
41329ec2f8
commit
911549aca3
3 changed files with 14 additions and 6 deletions
|
@ -10,6 +10,7 @@ class NumberInput extends React.Component {
|
|||
onChange: PropTypes.func,
|
||||
allowRange: PropTypes.bool,
|
||||
rangeStep: PropTypes.number,
|
||||
wdKey: PropTypes.string,
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
|
@ -107,6 +108,13 @@ class NumberInput extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let wdProps = {};
|
||||
if (this.props.wdKey) {
|
||||
wdProps = {
|
||||
"data-wd-key": this.props.wdKey
|
||||
};
|
||||
}
|
||||
|
||||
if(
|
||||
this.props.hasOwnProperty("min") && this.props.hasOwnProperty("max") &&
|
||||
this.props.min !== undefined && this.props.max !== undefined &&
|
||||
|
@ -146,6 +154,7 @@ class NumberInput extends React.Component {
|
|||
this.changeValue(e.target.value)
|
||||
}}
|
||||
onBlur={this.resetValue}
|
||||
{...wdProps}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
|
@ -159,6 +168,7 @@ class NumberInput extends React.Component {
|
|||
value={this.state.value}
|
||||
onChange={e => this.changeValue(e.target.value)}
|
||||
onBlur={this.resetValue}
|
||||
{...wdProps}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -12,10 +12,9 @@ class MaxZoomBlock extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
return <InputBlock label={"Max Zoom"} doc={latest.layer.maxzoom.doc}
|
||||
data-wd-key="max-zoom"
|
||||
>
|
||||
return <InputBlock label={"Max Zoom"} doc={latest.layer.maxzoom.doc}>
|
||||
<NumberInput
|
||||
wdKey="max-zoom"
|
||||
allowRange={true}
|
||||
value={this.props.value}
|
||||
onChange={this.props.onChange}
|
||||
|
|
|
@ -12,10 +12,9 @@ class MinZoomBlock extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
return <InputBlock label={"Min Zoom"} doc={latest.layer.minzoom.doc}
|
||||
data-wd-key="min-zoom"
|
||||
>
|
||||
return <InputBlock label={"Min Zoom"} doc={latest.layer.minzoom.doc}>
|
||||
<NumberInput
|
||||
wdKey="min-zoom"
|
||||
allowRange={true}
|
||||
value={this.props.value}
|
||||
onChange={this.props.onChange}
|
||||
|
|
Loading…
Reference in a new issue