mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 16:51:20 +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);
|
||||
this.state = {
|
||||
preview: false,
|
||||
public: false,
|
||||
saving: false,
|
||||
latestGist: null,
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ class Gist extends React.Component {
|
|||
const gh = new GitHub();
|
||||
let gist = gh.getGist(); // not a gist yet
|
||||
gist.create({
|
||||
public: true,
|
||||
public: this.state.public,
|
||||
description: styleTitle,
|
||||
files: files
|
||||
}).then(function({data}) {
|
||||
|
@ -115,6 +116,13 @@ class Gist extends React.Component {
|
|||
})
|
||||
}
|
||||
|
||||
onPublicChange(value) {
|
||||
this.setState({
|
||||
...this.state,
|
||||
public: value
|
||||
})
|
||||
}
|
||||
|
||||
changeMetadataProperty(property, value) {
|
||||
const changedStyle = {
|
||||
...this.props.mapStyle,
|
||||
|
@ -167,13 +175,22 @@ class Gist extends React.Component {
|
|||
<MdFileDownload />
|
||||
Save to Gist (anonymous)
|
||||
</Button>
|
||||
{' '}
|
||||
<CheckboxInput
|
||||
value={this.state.preview}
|
||||
name='gist-style-preview'
|
||||
onChange={this.onPreviewChange.bind(this)}
|
||||
/>
|
||||
<span> Include preview</span>
|
||||
<div className="maputnik-modal-sub-section">
|
||||
<CheckboxInput
|
||||
value={this.state.public}
|
||||
name='gist-style-public'
|
||||
onChange={this.onPublicChange.bind(this)}
|
||||
/>
|
||||
<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 ?
|
||||
<div>
|
||||
<InputBlock
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
|
||||
// BUTTON
|
||||
.maputnik-button {
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
background-color: $color-midgray;
|
||||
color: $color-lowgray;
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.maputnik-modal-sub-section {
|
||||
margin-top: $margin-1;
|
||||
}
|
||||
|
||||
.maputnik-modal-section--shrink {
|
||||
flex-shrink: 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue