Slight updates

main
Mike Fix 7 years ago
parent fd38138dae
commit 1cf0757324

@ -16,8 +16,8 @@ const Toolbar = (props) => (
/> />
<Settings onChange={props.onSettingsChange} enabled={props.enabled} /> <Settings onChange={props.onSettingsChange} enabled={props.enabled} />
<div className="buttons"> <div className="buttons">
<Button className="tweetButton" onClick={props.upload} title={props.uploading ? 'loading...' : 'Tweet Image'} color="#0084b4" style={{ marginRight: '8px' }} /> <Button className="tweetButton" onClick={props.upload} title={props.uploading ? 'Loading...' : 'Tweet Image'} color="#57b5f9" style={{ marginRight: '8px' }} />
<Button onClick={props.save} title="Save Image" color="#57b5f9" /> <Button onClick={props.save} title="Save Image" color="#c198fb" />
</div> </div>
<style jsx>{` <style jsx>{`
#toolbar { #toolbar {

@ -15,9 +15,9 @@ async function tweet (encodedImage) {
const processedData = encodedImage.split(',')[1] const processedData = encodedImage.split(',')[1]
return axios.post(`${DOMAIN}/twitter`, { data: processedData }) return axios.post(`${DOMAIN}/twitter`, { data: processedData })
.then((res) => res.data.url) .then(res => res.data.url)
.then((url) => encodeURIComponent(`Built with @carbon ${url}`)) .then(url => encodeURIComponent(`Built with #Carbon, by @dawn_labs ${url}`))
.then((uri) => `https://twitter.com/intent/tweet?text=${uri}`) .then(uri => `https://twitter.com/intent/tweet?text=${uri}`)
.then(openTwitterUrl) .then(openTwitterUrl)
} }
@ -62,6 +62,6 @@ function openTwitterUrl (twitterUrl) {
const left = (window.outerWidth - width) / 2 const left = (window.outerWidth - width) / 2
const right = (window.outerHeight - height) / 2 const right = (window.outerHeight - height) / 2
const opts = `status=1,width=${width},height=${height},top=${top},left=${left}` const opts = `status=1,width=${width},height=${height},top=${top},left=${left}`
window.open(twitterUrl, 'twitter', opts) window.open(twitterUrl, 'twitter', opts)
} }

@ -1,5 +1,5 @@
{ {
"name": "code-image-2", "name": "carbon",
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "main": "index.js",
"license": "MIT", "license": "MIT",

@ -71,7 +71,10 @@ class Editor extends React.Component {
this.getCarbonImage() this.getCarbonImage()
.then(api.tweet) .then(api.tweet)
.then(() => this.setState({ uploading: false })) .then(() => this.setState({ uploading: false }))
.catch(console.error) .catch((err) => {
console.error(err)
this.setState({ uploading: false })
})
} }
render () { render () {

Loading…
Cancel
Save