import Copy from 'BobjollCopy';
import { EventListenerOn } from 'Helpers';
EventListenerOn('body', '.copy__trigger', 'click', function(this: HTMLButtonElement, e: Event) {
let text = this.dataset.copy || '';
try {
Copy(text);
Notification.insert({
fixed: false,
id: 'copy-status',
class: 'notification--success notification--static notification--no-shadow mg-lv2 mg-x-none pd-none',
html: '...',
insert: {
element: this.parentElement || this,
position: 'afterend'
}
});
} catch(e) {
Notification.insert({
id: 'copy-status',
class: 'notification--error notification--static notification--no-shadow mg-lv2 mg-x-none pd-none',
html: '...',
insert: {
element: this.parentElement || this,
position: 'afterend'
}
});
}
});