From 97a76bd0d7b798bb7c113591a023d0392e625a46 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Thu, 17 Sep 2020 19:34:40 +0100 Subject: [PATCH] tweet button for quotes --- src/components/modals/Settings.jsx | 1 + src/components/widgets/Quote.jsx | 8 ++++++-- src/modules/defaultSettings.json | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/modals/Settings.jsx b/src/components/modals/Settings.jsx index 690fc85e..b07846cb 100644 --- a/src/components/modals/Settings.jsx +++ b/src/components/modals/Settings.jsx @@ -137,6 +137,7 @@ export default class Settings extends React.PureComponent {
+
this.resetItem(item)}/> diff --git a/src/components/widgets/Quote.jsx b/src/components/widgets/Quote.jsx index 3fc1b374..44eb2975 100644 --- a/src/components/widgets/Quote.jsx +++ b/src/components/widgets/Quote.jsx @@ -3,6 +3,7 @@ import Quotes from '@muetab/quotes'; import FileCopy from '@material-ui/icons/FilterNone'; import { toast } from 'react-toastify'; import * as Constants from '../../modules/constants'; +import TwitterIcon from '@material-ui/icons/Twitter'; export default class Quote extends React.PureComponent { constructor(...args) { @@ -77,12 +78,15 @@ export default class Quote extends React.PureComponent { render() { let copy = this.copyQuote()}>; - if (localStorage.getItem('copyButton') === 'false') copy = ''; + if (localStorage.getItem('copyButton') === 'false') copy = null; + + let tweet = window.open(`https://twitter.com/intent/tweet?text=${this.state.quote} - ${this.state.author} on @getmue`, '_blank').focus()}/> + if (localStorage.getItem('tweetButton') === 'false') tweet = null; return (

{`${this.state.quote}`}

-

{this.state.author} {copy}

+

{this.state.author} {copy} {tweet}

); } diff --git a/src/modules/defaultSettings.json b/src/modules/defaultSettings.json index 88d8fcd9..e2d92efd 100644 --- a/src/modules/defaultSettings.json +++ b/src/modules/defaultSettings.json @@ -78,5 +78,9 @@ { "name": "favouriteEnabled", "value": true + }, + { + "name": "tweetButton", + "value": false } ] \ No newline at end of file