tweet button for quotes

This commit is contained in:
David Ralph
2020-09-17 19:34:40 +01:00
parent ee4e49a058
commit 97a76bd0d7
3 changed files with 11 additions and 2 deletions

View File

@@ -137,6 +137,7 @@ export default class Settings extends React.PureComponent {
</Section>
<Section title={this.props.language.quote.title} name='quote'>
<Checkbox name='copyButton' text={this.props.language.quote.copy} />
<Checkbox name='tweetButton' text='Tweet Button' />
</Section>
<Section title={this.props.language.background.title} name='background'>
<BackgroundSettings language={this.props.language} resetItem={(item) => this.resetItem(item)}/>

View File

@@ -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 = <FileCopy className='copyButton' onClick={() => this.copyQuote()}></FileCopy>;
if (localStorage.getItem('copyButton') === 'false') copy = '';
if (localStorage.getItem('copyButton') === 'false') copy = null;
let tweet = <TwitterIcon className='copyButton' onClick={() => 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 (
<div className='quotediv'>
<h1 className='quote'>{`${this.state.quote}`}</h1>
<h1 className='quoteauthor'>{this.state.author} {copy}</h1>
<h1 className='quoteauthor'>{this.state.author} {copy} {tweet}</h1>
</div>
);
}

View File

@@ -78,5 +78,9 @@
{
"name": "favouriteEnabled",
"value": true
},
{
"name": "tweetButton",
"value": false
}
]