kentcdodds / old-kentcdodds.com

Kent's Homepage
http://kentcdodds.com
MIT License
735 stars 442 forks source link

Copies link to clipboard when clicking autolinked headers #703

Closed dianaeligg closed 3 years ago

dianaeligg commented 3 years ago

I keep finding myself referencing Common Mistakes with React Testing Library a lot when doing code reviews. This PR makes it so that when user clicks on anchor link, the href gets copied to the clipboard automatically. Saving the overwhelming task of clicking URL bar, highlighting url and copying the text.

Copy to clipboard code from: Clipboard API Adding class to Autolinked headers from: gatsby-remark-autolink-headers

kentcdodds commented 3 years ago

@All-contributors please add @dianaeligg for code

allcontributors[bot] commented 3 years ago

@kentcdodds

I've put up a pull request to add @dianaeligg! :tada:

dianaeligg commented 3 years ago

Cool idea, thanks!

Note that in the next few weeks this whole site is getting replaced by a complete rewrite. I'll try to remember to add this feature to the new site 😃

thanks! If it's still an open source site, I'll open up a new PR for this on the rewrite :)