mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 17:51:16 +01:00
Switch to using styleUrl for disabling button
This commit is contained in:
parent
4a0b9fd0de
commit
0c6a179cec
1 changed files with 7 additions and 4 deletions
|
@ -52,7 +52,7 @@ class OpenModal extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
isUrlEmpty: true
|
styleUrl: ""
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,14 +153,16 @@ class OpenModal extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpenToggle() {
|
onOpenToggle() {
|
||||||
|
this.setState({
|
||||||
|
styleUrl: ""
|
||||||
|
});
|
||||||
this.clearError();
|
this.clearError();
|
||||||
this.props.onOpenToggle();
|
this.props.onOpenToggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangeUrl = () => {
|
onChangeUrl = () => {
|
||||||
const length = this.styleUrlElement.value.length;
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isUrlEmpty: length < 1
|
styleUrl: this.styleUrlElement.value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,6 +215,7 @@ class OpenModal extends React.Component {
|
||||||
ref={(input) => this.styleUrlElement = input}
|
ref={(input) => this.styleUrlElement = input}
|
||||||
className="maputnik-input"
|
className="maputnik-input"
|
||||||
placeholder="Enter URL..."
|
placeholder="Enter URL..."
|
||||||
|
value={this.state.styleUrl}
|
||||||
onChange={this.onChangeUrl}
|
onChange={this.onChangeUrl}
|
||||||
/>
|
/>
|
||||||
<div>
|
<div>
|
||||||
|
@ -220,7 +223,7 @@ class OpenModal extends React.Component {
|
||||||
data-wd-key="open-modal.url.button"
|
data-wd-key="open-modal.url.button"
|
||||||
className="maputnik-big-button"
|
className="maputnik-big-button"
|
||||||
onClick={this.onOpenUrl}
|
onClick={this.onOpenUrl}
|
||||||
disabled={this.state.isUrlEmpty}
|
disabled={this.state.styleUrl.length < 1}
|
||||||
>Open URL</Button>
|
>Open URL</Button>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Reference in a new issue