* Add deps * Setup copy events * Updoot * Tweak styling * Do a lil' proof-of-concept * Updoot @github-docs/render-content * Use SCSS variables for custom styles * Adjust docs * Ignore clipboard in check-deps * Add copy annotation to quickstart workflow sample Co-authored-by: Cynthia Rich <crichID@users.noreply.github.com>
16 lines
377 B
JavaScript
16 lines
377 B
JavaScript
import Clipboard from 'clipboard'
|
|
|
|
export default () => {
|
|
const clipboard = new Clipboard('button.js-btn-copy')
|
|
|
|
clipboard.on('success', evt => {
|
|
const btn = evt.trigger
|
|
const beforeTooltip = btn.getAttribute('aria-label')
|
|
btn.setAttribute('aria-label', 'Copied!')
|
|
|
|
setTimeout(() => {
|
|
btn.setAttribute('aria-label', beforeTooltip)
|
|
}, 2000)
|
|
})
|
|
}
|