Copy button copies token to clipboard

This commit is contained in:
Andrew Nicolaou 2019-05-14 20:12:52 +02:00 committed by Cassie Tarakajian
parent ed87d4cd26
commit a03eed1603

View file

@ -7,12 +7,17 @@ import orderBy from 'lodash/orderBy';
const trashCan = require('../../../images/trash-can.svg'); const trashCan = require('../../../images/trash-can.svg');
function NewTokenDisplay({ token }) { function NewTokenDisplay({ token }) {
function handleCopyClick() {
navigator.clipboard.writeText(token);
}
return ( return (
<React.Fragment> <React.Fragment>
<p>Make sure to copy your new personal access token now. You wont be able to see it again!</p> <p>Make sure to copy your new personal access token now. You wont be able to see it again!</p>
<p><input type="text" readOnly value={token} /></p> <p><input type="text" readOnly value={token} /></p>
<button>Copy</button> <button onClick={handleCopyClick}>Copy</button>
</React.Fragment> </React.Fragment>
); );
} }