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

Enhancement added - Now copy Ayah feature includes Surah and Ayah number #647

Merged
merged 5 commits into from
Mar 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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