mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 17:31:14 +01:00
Merge pull request #241 from orangemug/feature/private-public-gist
Public/private gists
This commit is contained in:
commit
df3a42acce
3 changed files with 30 additions and 8 deletions
|
@ -26,6 +26,7 @@ class Gist extends React.Component {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
preview: false,
|
preview: false,
|
||||||
|
public: false,
|
||||||
saving: false,
|
saving: false,
|
||||||
latestGist: null,
|
latestGist: null,
|
||||||
}
|
}
|
||||||
|
@ -94,7 +95,7 @@ class Gist extends React.Component {
|
||||||
const gh = new GitHub();
|
const gh = new GitHub();
|
||||||
let gist = gh.getGist(); // not a gist yet
|
let gist = gh.getGist(); // not a gist yet
|
||||||
gist.create({
|
gist.create({
|
||||||
public: true,
|
public: this.state.public,
|
||||||
description: styleTitle,
|
description: styleTitle,
|
||||||
files: files
|
files: files
|
||||||
}).then(function({data}) {
|
}).then(function({data}) {
|
||||||
|
@ -115,6 +116,13 @@ class Gist extends React.Component {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onPublicChange(value) {
|
||||||
|
this.setState({
|
||||||
|
...this.state,
|
||||||
|
public: value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
changeMetadataProperty(property, value) {
|
changeMetadataProperty(property, value) {
|
||||||
const changedStyle = {
|
const changedStyle = {
|
||||||
...this.props.mapStyle,
|
...this.props.mapStyle,
|
||||||
|
@ -167,13 +175,22 @@ class Gist extends React.Component {
|
||||||
<MdFileDownload />
|
<MdFileDownload />
|
||||||
Save to Gist (anonymous)
|
Save to Gist (anonymous)
|
||||||
</Button>
|
</Button>
|
||||||
{' '}
|
<div className="maputnik-modal-sub-section">
|
||||||
<CheckboxInput
|
<CheckboxInput
|
||||||
value={this.state.preview}
|
value={this.state.public}
|
||||||
name='gist-style-preview'
|
name='gist-style-public'
|
||||||
onChange={this.onPreviewChange.bind(this)}
|
onChange={this.onPublicChange.bind(this)}
|
||||||
/>
|
/>
|
||||||
<span> Include preview</span>
|
<span> Public gist</span>
|
||||||
|
</div>
|
||||||
|
<div className="maputnik-modal-sub-section">
|
||||||
|
<CheckboxInput
|
||||||
|
value={this.state.preview}
|
||||||
|
name='gist-style-preview'
|
||||||
|
onChange={this.onPreviewChange.bind(this)}
|
||||||
|
/>
|
||||||
|
<span> Include preview</span>
|
||||||
|
</div>
|
||||||
{this.state.preview ?
|
{this.state.preview ?
|
||||||
<div>
|
<div>
|
||||||
<InputBlock
|
<InputBlock
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
|
|
||||||
// BUTTON
|
// BUTTON
|
||||||
.maputnik-button {
|
.maputnik-button {
|
||||||
|
display: inline-block;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-color: $color-midgray;
|
background-color: $color-midgray;
|
||||||
color: $color-lowgray;
|
color: $color-lowgray;
|
||||||
|
|
|
@ -21,6 +21,10 @@
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.maputnik-modal-sub-section {
|
||||||
|
margin-top: $margin-1;
|
||||||
|
}
|
||||||
|
|
||||||
.maputnik-modal-section--shrink {
|
.maputnik-modal-section--shrink {
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue