From 9bf3046d4c1c356ddbad502d768d84a8dbf207da Mon Sep 17 00:00:00 2001 From: orangemug Date: Fri, 2 Feb 2018 17:21:59 +0000 Subject: [PATCH] Public/private gists added. Fixes #238 Gists are now private by default with a option for public. --- src/components/modals/ExportModal.jsx | 33 ++++++++++++++++++++------- src/styles/_components.scss | 1 + src/styles/_modal.scss | 4 ++++ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/components/modals/ExportModal.jsx b/src/components/modals/ExportModal.jsx index 56a6481..674b20f 100644 --- a/src/components/modals/ExportModal.jsx +++ b/src/components/modals/ExportModal.jsx @@ -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 { Save to Gist (anonymous) - {' '} - - Include preview +
+ + Public gist +
+
+ + Include preview +
{this.state.preview ?