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} />
<div className="buttons">
<Button className="tweetButton" onClick={props.upload} title={props.uploading ? 'loading...' : 'Tweet Image'} color="#0084b4" style={{ marginRight: '8px' }} />
<Button onClick={props.save} title="Save Image" color="#57b5f9" />
<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="#c198fb" />
</div>
<style jsx>{`
#toolbar {

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

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

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

Loading…
Cancel
Save