Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
Enhancement added - Now copy Ayah feature includes Surah and Ayah num…
Browse files Browse the repository at this point in the history
…ber (#647)

* Enhancement added - Now copy Ayah feature includes Surah and Ayah number

* Rebased :)

* Stagin API Added
  • Loading branch information
imomer authored and mmahalwy committed Mar 12, 2017
1 parent 49dd17d commit 7cebbda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/components/Copy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import LocaleFormattedMessage from 'components/LocaleFormattedMessage';

export default class Copy extends Component {
static propTypes = {
text: PropTypes.string.isRequired
text: PropTypes.string.isRequired,
verseKey: PropTypes.string.isRequired,
}

state = {
isCopied: false
};

handleCopy = () => {
copyToClipboard(this.props.text);
copyToClipboard(`${this.props.text} - ${this.props.verseKey}`);
this.setState({ isCopied: true });

setTimeout(() => this.setState({ isCopied: false }), 1000);
Expand All @@ -36,4 +37,5 @@ export default class Copy extends Component {
</a>
);
}

}
5 changes: 3 additions & 2 deletions src/components/Verse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default class Verse extends Component {
currentVerse: PropTypes.string
};


static defaultProps = {
currentWord: null,
isSearched: false
Expand Down Expand Up @@ -181,11 +182,11 @@ export default class Verse extends Component {
}

renderCopyLink() {
const { isSearched, verse: { textMadani } } = this.props;
const { isSearched, verse } = this.props;

if (!isSearched) {
return (
<Copy text={textMadani} />
<Copy text={verse.textMadani} verseKey={verse.verseKey} />
);
}

Expand Down

0 comments on commit 7cebbda

Please sign in to comment.