forked from tanner/qotnews
Add a copy button to the article title
This commit is contained in:
@@ -44,7 +44,7 @@ function Article({ cache }) {
|
||||
}, [id]);
|
||||
|
||||
const copyLink = () => {
|
||||
navigator.clipboard.writeText(`${story.title} ${window.location.href}`).then(() => {
|
||||
navigator.clipboard.writeText(`${story.title}:\n${window.location.href}`).then(() => {
|
||||
setCopyButtonText('\uea10');
|
||||
setTimeout(() => setCopyButtonText('\ue92c'), 2000);
|
||||
}, () => {
|
||||
@@ -82,10 +82,7 @@ function Article({ cache }) {
|
||||
<meta name="robots" content="noindex" />
|
||||
</Helmet>
|
||||
|
||||
<div className='article-title'>
|
||||
<h1>{story.title}</h1>
|
||||
<button className='copy-button' onClick={copyLink}>{copyButtonText}</button>
|
||||
</div>
|
||||
<h1>{story.title} <button className='copy-button' onClick={copyLink}>{copyButtonText}</button></h1>
|
||||
|
||||
<div className='info'>
|
||||
Source: {sourceLink(story)}
|
||||
|
||||
Reference in New Issue
Block a user