Stacks icon indicating copy to clipboard operation
Stacks copied to clipboard

Add code copy buttons to docs

Open dancormier opened this issue 3 years ago • 4 comments

Addresses https://github.com/StackExchange/Stacks/issues/829

For now, I've only applied it to product/components/cards to keep myself from having to change it in 1000 places. It's out of draft to solicit some 👍/👎 on the approach, but consider this in "do-not-merge" territory.

TODO

  • [ ] Add copy button to all code snippets

Preview

2022-03-22 18 10 48

dancormier avatar Mar 22 '22 22:03 dancormier

Deploy Preview for stacks ready!

Name Link
Latest commit 3ea29dd014e69b7591fe524a1f22cff2d1da4e06
Latest deploy log https://app.netlify.com/sites/stacks/deploys/62c6fc2c693acf0009d0a4f3
Deploy Preview https://deploy-preview-883--stacks.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Mar 22 '22 22:03 netlify[bot]

Love this! Any chance we'll see it on SO one day? :)

MaxHorstmann avatar Oct 02 '22 01:10 MaxHorstmann

Hey @MaxHorstmann! Nice to hear from you!

These specific copy buttons are intended for the Stacks docs only, but I personally love the idea of introducing them to Stack Overflow, writ large. We have the s-codeblock component and we could enhance that component with some copy JS. I'll spread the idea around and see if it takes.

dancormier avatar Oct 04 '22 14:10 dancormier

@dancormier hey Dan, good to hear from you as well! Would be great to have this on code snippets on SO questions & answers, like on GitHub and many docs pages (random example) these days.

MaxHorstmann avatar Oct 05 '22 13:10 MaxHorstmann