Merge pull request #241 from orangemug/feature/private-public-gist

Public/private gists
This commit is contained in:
Orange Mug 2018-02-03 15:43:12 +00:00 committed by GitHub
commit df3a42acce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 8 deletions

View file

@ -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

View file

@ -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;

View file

@ -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;
} }